Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
add comment

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

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

1 Answer

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.

share|improve this answer
    
@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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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