On my Apache server I need to create new user accounts that would only access a specific folder, but when I try to change their root directory in ssh the server refuses to do it. I first tried to edit the sshd_config file to change the root directory of every accounts automatically, and when I saw that it was not working I tried to change it using usermod, here is the result:
>sudo usermod -R /var/www/userFolder sftpUser1 usermod: user 'sftpUser1' does not exist but sftpUser1 really exists, here is the line in the passwd file, and the same line with the -d command to change the home directory executes well.
sftpUser1:x:1001:1001::/var/www/userFolder:/bin/false Here is what I added in sshd_config
Match Group sftpusers ChrootDirectory /var/www/%u ForceCommand internal-sftp X11Forwarding no AllowTcpForwarding no Here is what appears in the Auth.log file after I tried to connect with the user
pam_unix(sshd:session): session opened for user sftpUser1 by (uid=0) fatal: bad ownership or modes for chroot directory component "/" The user belongs to the sftpusers group