Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 5 down vote accepted

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

Change

#allowsftp

to

allowsftp

Save.

share|improve this answer
1  
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
add comment

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
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.