I've created a user on my Ubuntu machine so that some people can log in and set up SSH tunnels and also so they can download some files from the system.

I don't want them to have shell access at all. Even if they had it, they wouldn't know what to do with it.

I can set their PuTTY clients not to request a shell, however if I do this, they enter their password and nothing comes up. They have absolutely no indication whether the login was successful or not unless they start trying to use the tunnels.

Also, this is disabling the shell on the client side rather than the server side, which I'm not too fond of.

What's the best way to maintain SSH tunneling and file downloading capacity while preventing the user from seeing a shell, but still giving them some welcome message upon login?

Can I just write a bash script, for example, that echos out "Welcome", and set that as their shell?

  • What is the goal? – Lucio Oct 21 '14 at 2:37

According to this page you can set the users' login shell to /sbin/nologin and they will still be able to use port forwarding and other, non-shell authentication.

You may need to tweak your server configuration, see the linked page for more details.

  • Thanks for the response. I'm aware of /sbin/nologin however in that case how do I give them a message alerting them to a successful login? – Ozzah Oct 21 '14 at 3:20
  • OK, I see your point. On linux client you can use option -N and a sufficient number of options -v to get the verbosity that will tell you if your login failed. Perhaps try something similar with the PuTTY client? – sмurf Oct 21 '14 at 3:24
  • I understand your suggestion. The issue is, the user enters their username, then enters their password. Then, if PuTTY is set to not request a shell, no more output is displayed. They have no idea if the password was accepted or if their Internet connection went down, etc. It's just a bit strange to enter the password and then nothing visible happens. I don't think you can set the verbosity inside the Windows client's shell area. – Ozzah Oct 21 '14 at 3:33

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.