How to configure an SSH server to only allow users to transfer files using the SFTP protocol, without being able to log in with their username ?

Note: If the user's shell to nologin or null is not possible to change this

  • I don't understand your note. Your sentence isn't grammatically correct and I don't understand what you're trying to say. Are the users' shell set to nologin or not? Why wouldn't you change this, since it's the way to do what you want? Mar 1 '15 at 1:18

Check your /etc/ssh/sshd_config. Find the line something like Subsystem sftp /usr/libexec/openssh/sftp-server. Next you have two options (should work both, I do not remember which one I have used). First, you may register this executable as a shell and set it for the user, or, the second one, ForcedCommand for that user in sshd_config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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