16
Feb
09

Limiting a Linux account to SFTP only

If you need to allow a user to connect to your Linux server with SFTP but do not want to give them the ability to log in via SSH you can do the following:

Add the user account and set the home directory to where you want their root directory to be.

useradd -d /path/to/files/ username

Set the user’s password

passwd username

Modify the user’s shell to use the “sftp-server” shell included in the lib directory (path may vary)

usermod -s /usr/libexec/openssh/sftp-server username

Add the “sftp-server” shell to your system shells

echo ‘/usr/libexec/openssh/sftp-server’ >> /etc/shells

or

vim /etc/shells and add the path manually

The user should now be allowed to login via SFTP only.


0 Responses to “Limiting a Linux account to SFTP only”



  1. No Comments Yet

Leave a Reply




February 2009
M T W T F S S
     
 1
2345678
9101112131415
16171819202122
232425262728  

Months