Similar : http://www.techrepublic.com/blog/linux-and-open-source/chroot-users-with-openssh-an-easier-way-to-confine-users-to-their-home-directories/229/
*** If this ends with :
fatal: bad ownership or modes for chroot directory component "/path/to/chrooted/folder/"
in /var/log/auth.log, have a look at : https://wiki.archlinux.org/index.php/SFTP_chroot
==> It's basically a matter of "chmod 755" along the chrooted path.
*** At upload time : "open for write: permission denied"
- the chroot dir is a jail a user may read, but not write. If write permissions are granted to users on the chroot dir, OpenSsh regards it as unsecure and denies connection.
file tree :
/home (755, root:root)
/home/folder1 (755, root:root)
/home/folder1/folder2 (755, root:root)
/home/folder1/folder2/upload (775, root:sftpGroup)
When loging via SFTP, Bob :
- enters /home/folder1/folder2/, displayed as / . He has read-only access here
- can see /home/folder1/folder2/upload, can enter it and read/write there.