I'm trying to give an SFTP only access to his home directory to a user.
This is the /etc/passwd line for the user:
bob:x:1003:1003::/home/bob:/bin/false
I edited the /etc/ssh/sshd_config file like that:
#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
Match user bob
AllowTcpForwarding no
X11Forwarding no
ForceCommand internal-sftp
Then I restart ssh: sudo service ssh restart
If I try sftp bob@myserver.com
everything works well.
Then I try to Chroot bob to his home, so I add ChrootDirectory /home/bob
in the right place:
Match user bob
ChrootDirectory /home/bob
AllowTcpForwarding no
X11Forwarding no
ForceCommand internal-sftp
I changed the permission to bob home:
drwxr-xr-x 3 root root 4096 2014-02-27 13:13 bob
Now when I try sftp bob@myserver.com the answer is:
Write failed: Broken pipe
Connection closed
my OpenSSH version is 1:5.5p1-4ubuntu6
Where I'm wrong??? Where I can look to solve my problem???
EDIT: after a bit of debugging i found this error message:
bad ownership or modes for chroot directory component "/"