LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   changed root's shell accidentally (https://www.linuxquestions.org/questions/linux-newbie-8/changed-roots-shell-accidentally-232652/)

frankie_DJ 09-19-2004 05:23 PM

changed root's shell accidentally
 
huh...I don't know if you've seen this one before.

I just installed Slackware 10.0 a week ago and I am still battling basic stuff.
I accidentally (by logging in as 'su' and then forgetting about it) changed root's login shell to ksh. Now I can't login as root anymore!!!
Actualy I can, but I get immediatelly kicked out. As soon as I login it gives me:

Cannot execute ksh; No such file or directory

and kicks me out.

Is there a way to fix this?

btmiller 09-19-2004 05:41 PM

Try going in with 'su' (not su - so you don't get root's environment) and editing /etc/passwd to provide the full correct path to the shell. If that doesn't work, you'll need to boot into signle user mode to do the same thing.

frankie_DJ 09-19-2004 06:23 PM

HUh....The first thing doesn't work - I get the same message. I booted into the SU mode and tried to edit the file but it wouldn't let me - I think because I was logged in as a regular user (that's the onlly way I can log in).

bornhj 09-19-2004 06:43 PM

Not using Slackware, I can't offer advice on it. But, with Fedora 2, CD1 includes a rescue mode. If you login to that, you can edit files on your system without booting it. Also, I'm not sure if it would work, but if you can get your hand on a CD based distro like Knoppix you could probably edit from there.

frankie_DJ 09-19-2004 06:59 PM

Well I just booted from my boot floppy. But...I am still not allowed to edit /etc/passwd. Am I doing it right?
Reboot with the floppy, mount with read-write option, login as a user...

Bornhj, is this the same way I'd do it with CD?

bornhj 09-19-2004 07:36 PM

Fedora's rescue CD automatically assigns you root permissions in rescue mode.

If Slackware has this same function on one of it's CDs, then you should be able to type something like 'linux rescue' at the prompt (if it has one) and this will give you root permissions at a bash (or sh) shell.

(I am a newbie to Linux too, just discovered rescue mode when I had to edit my xorg.conf file, then i realised I could go to runlevel 3 from Grub)

[EDIT: Solution from MasterC below. Thanks :D]

MasterC 09-19-2004 07:40 PM

You ought to be able to boot with your slack CD or any of the millions of Live CD's available and mount up the / partition (or wherever /etc is located) to a /mnt directory and then edit /etc/passwd to your liking.

Cool

frankie_DJ 09-19-2004 11:28 PM

coooool :-)))

it worked out. had to learn a little bit of vi cause it was the only editor available (i thought
i'd leave vi for latter. ya, right!)

thank u guys for the help.

man, this thing is such an awesome toy, i could play with it forever. except that i have to go to stupid work tomorrow #$%^%$# !


All times are GMT -5. The time now is 04:37 AM.