I have a user that has their shell set to nologin, or actually a different binary "noshell" provided by cPanel.

whatever the case, I want to know if setting their shell this way is enough to prevent them from accessing the server and reaching its files.

when I log in with their key to SFTP I receive an error telling me unexpected end of file, but I am not entirely sure if that would be enough.

Additionally, how do I explicitly deny this user from using SFTP?


  • I put my untrusted users (students!) in a group, set their shells to /bin/false, and then set up the internal-sftp engine in SSH so that it chroots them and sets a stricter default umask. – ivanivan Jun 6 '18 at 13:04

I can confirm that with OpenSSH_7.2p2 (On Ubunutu), setting user shell to /usr/sbin/nologin disables sftp.

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.