I would like to restrict a user (user sftp-user, group webgroup) to sftp access for the /var/www/html directory in CentOS 8. They should have read and write permissions so they can make changes to website files.
I am able to successfully jail the user to their homedir with
ChrootDirectory %h but I can't quite get it to work when I change it to
ChrootDirectory /var/www/html in /etc/ssh/sshd_config. The user gets this error when trying to sftp:
fatal: bad ownership or modes for chroot directory "/var/www/html"
What I did is try to use
setfacl to give the group webgroup rw- permissions for /var/www/html (though not recursively, but everything inside that folder is owner by
How do I get it to work? I've seen some solutions suggest using
mount, I'm not sure if that's the better solution.
html folder is owner by
root:root, and everything inside it is owned by
sftp-user:webgroup as I mentioned. Is this the correct ownership?
for the sake of completeness, here's the output of
# file: html/ # owner: root # group: root user::rwx group::r-x group:webgroup:rw- mask::rwx other::r-x