Is it possible to ssh to a machine as a user with no valid shell (say, mail)? So far I cannot, and using the command below doesn't work:

$ ssh mail@machine.local /bin/bash

It will always say "This account is currently not available.". But if I'm logged-in to the machine and use 'su'

$ su mail -s /bin/bash

I can become user mail.

migrated from stackoverflow.com Mar 18 '11 at 13:34

This question came from our site for professional and enthusiast programmers.


The command passed to ssh is run by the shell on the server, so if no valid shell is specified then it is not possible to run it.

  • @Ignacio: Makes sense...but are there any known workaround to this? – icasimpan Mar 18 '11 at 9:37
  • 1
    You could use a key and put an entry in ~/.ssh/authorized_keys to allow executing a different command. – Ignacio Vazquez-Abrams Mar 18 '11 at 9:38
  • 1
    @Ignacio: I fail to see how adding another way to authorize a user changes the shell being launched on login. And if mail has no $HOME, where would you put a key? – alex Mar 18 '11 at 15:28
  • @Alex: mail has a $HOME it's /var/spool/mail. So I tried @Ignacio's suggestion to put an ssh key but it's not being accepted by the server. – icasimpan Mar 23 '11 at 4:07

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.