Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to give sftp access to a user without giving him ssh access?

share|improve this question
Do you mean allow user to sftp into the machine, or sftp out of the machine from the shell? – apoorv020 Jan 10 '11 at 7:09
Allow user to sftp into the machine of course ;) – Olivier Lalonde Jan 10 '11 at 9:38
up vote 3 down vote accepted

Set the last parameter of the /etc/passwd file (on the user's line) to /usr/lib/openssh/sftp-server (or whatever sftp server you use). This will make it so that the logon shell for the user is the sftp-server, and that's all he can use. This requires less setup than the other answer, and it gets exactly to the point, although the option to allow scp later doesn't exist.

share|improve this answer

Well, rssh is a restricted shell providing sftp access but no ssh access.

sudo apt-get install rssh
sudo chsh -s /usr/bin/rssh $username

You might have to

sudo bash -c "echo '/usr/bin/rssh' >> /etc/shells"

to make it a "valid" shell.

Update 9-13-2012 for Ubuntu 12.04

The file, /etc/rssh.conf, has the various kinds of access commented; so, for sftp, uncomment line #10, "#allowsftp".

sudo -e /etc/rssh.conf






share|improve this answer
I've just updated this post for 11.10. The binary location has moved. Keep that in mind if you're using this on older versions of Ubuntu (Sorry, I don't know when it happened). – Oli Mar 1 '12 at 23:40

Sometime It is useful to set umask for ftp client. To do that, create a simple script /usr/lib/openssh/

/usr/lib/openssh/sftp-server -u 0007

and use it in /etc/passwd instead.

share|improve this answer

Your Answer


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.