ChrootDirectory Jail with sftp
I have a server that several users connect to to retrieve files via ftps and sftp. (I leave the choice up to the user). Just the other day I read about the ChrootDirectory option for SSH which allows me to jail the users to their home directory, much like the ftps users are.
Here are the steps I used for the setup. (Fedora 9 )
I commented this line out of /etc/ssh/sshd_config:
#Subsystem sftp /usr/libexec/openssh/sftp-server
and added these lines:
Subsystem sftp internal-sftp
Match Group sftponly
I added the sftponly group
And then to set up a new jailed user,(steveperry) I take the following steps:
usermod -G sftponly steveperry
chown root /home/steveperry
chmod 750 /home/steveperry
chown steveperry:steveperry /home/steveperry/steveperry
usermod -d /home/steveperry/steveperry steveperry
And this works well. If steveperry chooses ftps, he's jailed to the /home/steveperry/steveperry directory. If he chooses sftp, then he's jailed to the /home/steveperry directory and can read and write to the /home/steveperry/steveperry directory.
Now, here's my question: Using sftp, when steveperry connects, his starting location is /home/steveperry, which he cannot write to. He will have to issue a cd steveperry to get to the directory he can read and write to.
Is there anything I can set on the server that will do this for him automatically?