I'm hoping someone can help me figure out how to chroot jail users to their home directories for SFTP with Chef. I've tried multiple SSH cookbooks and Googled for an answer for several days with no luck (though honestly it's possible I just don't know what to search for).
What I've done so far is setup a data bag for users that successfully creates the users, assigns them to an sftponly
group, and creates their home directory in a domain.tld
format.
My problem is that once I try to connect via SFTP I can successfully be placed in the user's home directory, but can simply move up to either the parent directory or the root directory of the server. I've setup SFTP before, it was full of problems but I finally got it to work. I'd like to be able to just have all of the setup handled by Chef though.
This is what I need to know:
- Which Chef cookbook should I use?
- What attributes / settings do I need to specifically set to Chroot jail a user in the
sftponly
group to their home directory while still allowing the root user SSH access?