SFTP user with limited access

Objective: create a sftp user but limited to certain directory ONLY!

[root@web.local-01 ]# uname -a
Linux web.local 2.6.18-164.6.1.el5 #1 SMP Tue Nov 3 16:12:36 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@web.local-01 ]# adduser -d /home/limited/directory/path -g sftp-user username
[root@web.local-01 ]# echo "/home/limited/directory/path" >> /etc/shells

now testing:

adam-othmans-computer:~ alak$ sftp -o Port=9321 username@web.local
Connecting to web.local...
username@web.local 's password:
sftp> ls
sftp> mkdir testdir
sftp> ls
sftp> cd /
sftp> ls
Couldn't get handle: Permission denied
sftp> exit


kudos: hmlee, http://www.itworld.com/network-access-control/66828/sftp-only-user-accounts



Popular posts from this blog

SAP: Segregate Different SMTP Mail Server Based on Sender Domain

PLESK: Disk usage statistics showing wrong data [Part 1]