System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Need only sftp access not ssh for specific user

 
Ganesan R
Honored Contributor

Need only sftp access not ssh for specific user

Hi,

I need to give sftp access only and not ssh for specific users.

Could someone help how to achieve this?

I tried giving /usr/bin/false as shell. but both ssh and sftp connections not getting established. getting connection closed message.

Best wishes,

Ganesh.
2 REPLIES
Ivan Krastev
Honored Contributor

Re: Need only sftp access not ssh for specific user

Have you tried with shell - /opt/ssh/utils/sftponly ?

Check also script ssh_chroot_setup.sh

regards,
ivan
Johnson Punniyalingam
Honored Contributor

Re: Need only sftp access not ssh for specific user

creating a dummy shell that allows the user to do nothing.
I.e., compile this:


#include


int main ()
{
fprintf (stderr, "Sorry, sftp-only account. Bye.\n");
exit (0);
}


Give the executable a name like /usr/local/bin/sftp-only-shell
and then put that as the shell for each user who needs to be
sftp-only.


I believe you will also want to add that pathname to /etc/shells,

Thx,
Johnson
Problems are common to all, but attitude makes the difference