Ssh – How to allow write on SFTP only setup

freebsdsftpssh

I'm trying to setup FreeBSD 10 with an account that can SFTP, but not SSH.

I've got my sftponly group and my specific account is a member of that group. My sshd_config contains:

Match Group sftponly
ChrootDirectory /home/account
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

The /home/account is mode 755 with root:sftponly ownership. In this configuration I can login, list the directory, and "get" files but cannot upload files (write permission denied). If I change the account directory to 775 to give the sftponly group write permissions, then the login is blocked. What's the appropriate setup for allowing read AND write SFTP operations with SSH blocked?

Best Answer

Like the comment says OpenSSH is pretty strict about what permissions it allows on chroot directories (for good reasons). So the solution is to have a subfolder with the permissions you want to use for your particular case.