How to create a user with a non-standard home directory
Environment
Red Hat Enterprise Linux
openssh
Issue
How to create an
SSHuser with a non-standard home directory.
Resolution
Create the home directory for the user.
# mkdir -p /path/to/directory/userFor example:
# mkdir -p /storage/media/myuserApply the correct
SELinuxlabel.
# chcon -Rv --type=user_home_dir_t /path/to/directory/userFor example:
# chcon -Rv --type=user_home_dir_t /storage/media/myuserCreate the user and specify the home directory.
For example:
Change the file permission and ownership of the home directory.
For example:
Use the
ssh-copy-idcommand to copy thesshkey from the client to the server.
For example:
Apply the correct
SELinuxsecurity context to theauthorized_keysfile.
For example:
Verify you can log in successfully.
PreviousConfigure Ubuntu 22.04 as a DNS server using ControlDNextHow to create a chroot sftp user with logging on a non-standard home directory
Last updated