Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I love fish. I have a nice Ubuntu 8.04 Server running some services. So I edited the /etc/passwd file, as I did in the past, to change my default shell from bash to fish. And ,yes, I made I typo (BTW: I know about chsh, I'm just that stupid and overconfident). Please, stop laughing.

As expected, now I can't login. Is it possible log in without restarting the server?. I know that I can restart the server in safe mode and solve the mess, but I'd like to avoid it.

Oh yeah, I have no other user with sudo rights in that server. Stop laughing again.

BTW, I made the mess using ssh, but I have easy physical access to the server, it's just a couple of rooms away.

share|improve this question
3  
I don't have a solution for you (suspect you do need to go and physically reboot the machine), but in future you should use chsh to change your login shells. It checks that you enter something which is valid (specified in /etc/shells) –  Iain Lane Dec 22 '10 at 10:54
    
I know, read the bit about being stupid and overconfident ;). Thank you anyway. –  Javier Rivera Dec 22 '10 at 11:04
    
A simple NO, could be an answer too. Likely the correct one. BTW I had rebooted the server and corrected the mess by now. –  Javier Rivera Dec 23 '10 at 7:49
add comment

3 Answers 3

up vote 5 down vote accepted

Unfortunately, no; you've locked yourself out. SSH won't let you log in if the shell is missing. Here's what the attempt looks like in /var/log/auth.log:

Dec 23 15:04:59 ubuntu sshd[5585]: User kees not allowed because shell /bin/fish does not exist

And on-console TTY login will always attempt to launch your configured shell. Without another user with sudo rights, you'll need to boot to single user mode to fix it. :(

share|improve this answer
add comment

If you have a root password set, you can either log in as root on the machine itself (Either in X or on a virtual console by hitting alt-F1), or remote in as a non-sudoing user and then switch to root using su in a terminal.

Of course, Ubuntu doesn't let you log in as root by default, so this assumes you had previously changed that.

share|improve this answer
add comment

If you want to restore some configuration files back to some previous state, you can always try to edit them, by booting your server with a Live version of some Ubuntu CD, mount the actual partition where the /etc files are located and edit them using vi.

You could also edit the file /etc/sudoers, in order to give more users the rights to become root.

share|improve this answer
    
The trick is to avoid rebooting the server ;). Thanks anyway. –  Javier Rivera Dec 22 '10 at 15:47
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.