I'm starting a very little hosting company for a few friends and little clients, nothing big.

I want to give my "clients" the right to manage their files on the server. I hate FTP as it is not secure and it's in my opinion obsolete.

So I'd like to allow my users to connect through SFTP but not allow them to connect through SSH. (I know, I know, SFTP is using SSH). But I was just wondering, is it possible?

So I wouldn't have to install a FTP service on the server and everything would be awesome! :-D

Thanks a lot!

link|improve this question

42% accept rate
feedback

4 Answers

Starting with version 4.9 OpenSSH has an internal-sftp subsystem:

Subsystem sftp internal-sftp

And then block other uses:

Match group sftponly
     ChrootDirectory /home/%u
     X11Forwarding no
     AllowTcpForwarding no
     ForceCommand internal-sftp

Add your users to the sftponly group. You have to change the user's homedirectory to / because of the chroot and /home/user should be owned by root. I'd also set /bin/false as the user's shell.

link|improve this answer
Wow! Super-awesome! I'll test this out and come back here to validate. Thanks a lot! – Tom Jan 28 at 20:48
+1 for the ChrootDirectory thing! – Kyle Hodgson Jan 30 at 18:30
feedback

There is a shell scponly what does this. It can chroot too.

link|improve this answer
This would come great if you need both SFTP users and SSH users. You just replace the shell in /etc/passwd for those restricted only to SFTP. – Dragos Feb 23 at 8:12
feedback

You can modify /etc/passwd and give that user a fake shell so that he can not use ssh.

link|improve this answer
5  
Did you test this? – splattne Jan 29 at 8:49
feedback

Checkout rssh which is a fake shell that allows sftp but denies ssh

More about RSSH

http://www.pizzashack.org/rssh/

RPMs

http://pkgs.repoforge.org/rssh/

You can configure rssh to allow / deny different behaviours like sft, scp etc.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.