I am trying to create chroot user but i want to give him a permissions to create and delete files and directories. I have Ubuntu server installed on virtualbox and i am connecting to it from my host machine Windows 7 using WinSCP. And i am also connecting to Ubuntu server with Cygwin through ssh. These are the permissions for the home directory of the chroot user which is "sites":

root@ubuntu:/var/www# ls -l total 12 -rw-r--r-- 1 root root 177 2015-02-06 20:57 index.html -rw-r--r-- 1 root root 20 2015-02-07 18:04 index.php drwxr-xr-x 3 root root 4096 2015-02-08 22:23 sites

With this settings i am able to connect to the server with the chroot user account but it doesn't allow my to create or delete files. I tried to change the permissions to bob:root and bob:sftponly but then i can't connect to the server. "bob" is the chroot user and "sftponly" is his group.

I am also not able to connect through sftp using Cygwin which is strange because i am able to connect using WinSCP.

And these are the settings from sshd_config

Subsystem sftp internal-sftp

Match Group sftponly
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no


I found what was the problem. I had to change the custom home directory for user bob which was /var/www/sites to /var/www/. Then give root:root permissions for www directory and bob:sftponly permissions for sites directory. Now i can login with the chrooted user and write in sites directory but not in the www directory which i guess is the normal way how it should work.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.