How do I restrict SFTP users access to a specific directory?

Hello everybody!

I decided to not use FTP so I don't have to open up port 21, and use SFTP instead.  It works great for me, I use my SSH login.  But I want to set it up for someone else and let them only access the directory with their website, which is "/var/www/website".

So I want to add a new user, that can only access the server via SFTP, and when they log in using an SFTP client, they go straight to that directory and can only go into its subdirectories, not the parent directories.

thanks
parlaysAsked:
Who is Participating?
 
woolmilkporcCommented:
Hi,

consider using 'rssh'. It supports 'chrooting' and restricting users to any or all of scp, sftp, rsync, rdist or cvs.

Here it is:

http://sourceforge.net/project/showfiles.php?group_id=65349

... and this is a neat howto:

http://www.cyberciti.biz/tips/rhel-centos-linux-install-configure-rssh-shell.html

wmp


0
 
amroxCommented:
I did exactly this once with SFTP on Redhat 5
I downloaded openssh 5.1, compiled/installed it then set up my chroot jail in sshd_config
Here is a guide which has a step by step process: http://rothwerx.com/node/8
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.