Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I change my shell to be something like /bin/abc, where abc is something random (or may not even exist), what happens when I login (assume that I have added it to /etc/shells, so chsh won't whine.)? Is there a default shell that it switches to or will it just give an error and not let me login?

share|improve this question
    
It may not give you an error, it may just act like have "/bin/false" as a shell, which effectively disables interactive (shell based) login –  Zeke Hansell May 12 '11 at 15:22
2  
Judging by your question, shouldn't your name be "sudo rm -rf /*" or "Ihatemyadmin"? –  Blomkvist May 12 '11 at 15:25
2  
@Blomkvist: I tried, but / and * were invalid characters :( –  user70365 May 12 '11 at 15:40
1  
This system needs a "Humour" badge for comments like the previous two (they definitely earned it!). –  Randolf Richardson May 12 '11 at 15:46

3 Answers 3

up vote 3 down vote accepted

You will be unable to log in, and must have the sysadmin fix it.

share|improve this answer
2  
Basically, if your shell is invalid it will not be able to log you in. Or rather you will log in (authenticate) and immediatedly log you out because the shell won't run. –  Zeke Hansell May 12 '11 at 15:22
    
thanks, that's what I thought too. –  user70365 May 12 '11 at 15:44

It takes three lines to find the answer on your own:

# useradd -m -p $(mkpasswd test) -s /nix test
# login
sn-e0692 login: test
Password: 
Linux sn-e0692 2.6.32-bpo.5-amd64 #1 SMP Fri Jun 11 08:42:31 UTC 2010 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Cannot execute /nix: No such file or directory
# userdel -rf test
share|improve this answer

As others have already answered, you won't be able to login to a shell prompt...

If you have SSH set up, you might be able to use it to fix things if it's handling shells differently, or at least letting you use SCP to upload a corrected file (such as the one that defines which shell your user accounts use).

FTP probably won't (and shouldn't) have access to the files you need to update, but I mention this because perhaps this could get you thinking of other alternatives? Do you have a web server running with some sort of file management console that can do this for you?

share|improve this answer

Your Answer

 
discard

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