Click to See Complete Forum and Search --> : Cannot login because bash not found


tony_yum
07-04-2007, 05:57 AM
Hi All,

I am having a bit of screw up. Please help. I did


usermod -s bash


with root. and exited the root shell. I can no longer su or even login normally into root.

I get this message "Cannot execute bash: No such file or directory". I know I should have done usermod -s /bin/bash instead. But now I can't change the /etc/passwd file to set the shell anymore since I can't get to root. su -s /bin/bash doesn't work, because my user is under privileged and $SHELL and -s get's ignored.

Is there no way for me to get back into root? Please help? I am thinking of logging out of nautilus and log back in as root. Just worried that I won't be able to log back in and I'm in trouble.

Thanx

Tony

deathadder
07-04-2007, 07:46 AM
If you've got a live CD you can boot onto it and try this:

root@livecd: mkdir /mnt/temo
root@livecd: mount /dev/sdXx /mnt/temp
root@livecd: chroot /mnt/temp /bin/bash
root@debian: usermod -s /bin/bash

tony_yum
07-04-2007, 08:26 AM
Mmmm... don't have a live CD. But if there's no other way, I'd get one.
Thanx

deathadder
07-04-2007, 09:28 AM
Well if you've got the Gentoo install CD, going from your sig ;), can use that. Or if you've got a floppy drive / disk around, and don't want to download a whole CD use one of these: http://www.linuxlinks.com/Distributions/Floppy/

I would recommend keeping a Knoppix disk around though.

tony_yum
07-04-2007, 10:38 AM
Yeah, just that I'm on my client's PC and this is my last day at work. I've got the gentoo and Knoppix cd at home. Oh well, might try logging out of nautilus and login as root at the end of the day and hope that I could get the gdm process to start the wm session and fork out the usermod command bypassing the bash bit. Leave it 'til the end of the day though :P

Shouldn't have messed around with the System, all because I got bored....

tony_yum
07-04-2007, 12:40 PM
Wooohooo. Done fixed it now. Trying logingin through gdm to root, but that doesn't work because the setting says that I'm not allow to use gdm to login as root. But I managed to use System > Administration > Users and Groups from the Nautilus menu bar. There I was able to change the shell for root. Strange I don't even need the password for root to indirectly edit the /etc/passwd file. The tool ask for my user's password instead. Doesn't seemed too secure...

Anyway this thing got me half worried. Thanx guys.

Tony