I need some help on this.
I'm attempting to jail SSH users into their own folders so that they can SFTP into a server without seeing the filesystem
I have following a simple guide online and managed to jail a user into their default home folder (/home/user). However if I attempt to change their home folder the user cannot log in.
I have 2 users: kevin and default
cat /etc/passwd
reveals
kevin:x:500:500::/home/kevin:/bin/false
default:x:501:500::/var/www/vhosts/default:/bin/false
and my sshd_config file looks like
Subsystem sftp internal-sftp
Match Group sftponly
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
and cat /etc/group
reveals
sftponly:x:500:default,kevin
kevin:x:501:
default:x:502:
Does anyone know why the user kevin works as expected, but the user default is unable to login.
Thanks.
EDIT
I've edited my passwd file and change default:x:501:500::/var/www/vhosts/default:/bin/false
to default:x:501:500::/home/default:/bin/false
and the default user can now login.
The problem only seems to happen if I want to change the user's home to /var/www/vhosts/user
setenforce 0
to temporarily disable it.