Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i've created an user on ubuntu 10.04 and wanted to jail the user by disabling ssh shell and allow sftp. when there is no ChrootDirectory in the sshd_config the user can login just that it can see other sibling folders.

let's say i only want the user to access /var/www/vhost/shop.mydomain.com so that's the home folder of my new user is set to that.but the use could browse via filezilla everything under /var/www/vhost/*. i followed this post and so far that's the only kink. I would be glad if anyone can give me a tip. thanks

share|improve this question
    
Is the user using an ftp or sftp connection ? –  Iain Aug 29 '12 at 16:52
    
am(using the user creds to login) using an sftp with filezilla –  black sensei Aug 29 '12 at 17:02
add comment

1 Answer

You need to pay close attention to the notes about permissions on the ChrootDirectory section of the man page.

Specifies the pathname of a directory to chroot(2) to after authentication. All components of the pathname must be root-owned directories that are not writable by any other user or group. After the chroot, sshd(8) changes the working directory to the user's home directory.

So /var, /var/www, /var/www/vhost, /var/www/vhost/shop.mydomain.com should all look like drwxr-xr-x 22 root root 4096 date ....

share|improve this answer
    
Indeed it seems i have a problem understanding After the chroot, sshd(8) changes the working directory to the user's home directory. What does that mean? let's say i do sudo chown -R 711 root:root /var/www what's next? –  black sensei Aug 29 '12 at 18:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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