LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Stupid mistake - changed root shell to /bin/false (https://www.linuxquestions.org/questions/linux-general-1/stupid-mistake-changed-root-shell-to-bin-false-272783/)

Kholnuu 01-01-2005 11:13 PM

Stupid mistake - changed root shell to /bin/false
 
Wasn't paying attention to which terminal I was typing in, and instead of changing the shell of a test account, I changed root's shell to /bin/false.

Now I can't log into root, can't su into root, can't do anything with the root account. That's bad.

What's worse is that I'm not located anywhere near the computer. I can probably fix this issue with Knoppix when I get home, but that will be some time from now.

Is there a way I can fix this remotely?

Thanks in advance for any help anybody can provide, and excuse my idiocy. :)

Scruff 01-01-2005 11:32 PM

Not that I can think of ;) Some type of LiveCD locally will be your best bet.

slackie1000 01-02-2005 02:47 AM

hi there,

do you have
Code:

/etc/sudoers
configured?
you could mess with 'sudo'. you can execute commands with 'root' right without shell invoking.
i don't see any other chance, considering that you are with remote access.

regards
slackie1000

Kholnuu 01-02-2005 03:42 AM

I didn't have sudo installed, no, but I downloaded the package. I'll install it once I get root access back.

Looks like my only plan is to wait until I can get back to the machine, boot up on my recovery CD, mount the harddrive, and edit from there.

Ah well.

btmiller 01-02-2005 02:32 PM

No need ... use su with the -s option. That lets you specify which shell to use, overriding the entry in /etc/passwd.

Kholnuu 01-02-2005 05:55 PM

Quote:

Originally posted by btmiller
No need ... use su with the -s option. That lets you specify which shell to use, overriding the entry in /etc/passwd.
I believe you mean: su -s /bin/bash or something similar? I get the prompt for the root user, but then get immediately dumped back to the original account I was in.

http://www.rt.com/man/su.1.html

Quote:

-s, --shell shell
Run SHELL instead of USER's shell from /etc/passwd,
unless the user running su is not the superuser and
USER's shell is restricted
If I had screwed up any account other than root, I'd be good to go.

slackie1000 01-03-2005 03:31 AM

Quote:

Originally posted by Kholnuu
I believe you mean: su -s /bin/bash or something similar? I get the prompt for the root user, but then get immediately dumped back to the original account I was in.

http://www.rt.com/man/su.1.html



If I had screwed up any account other than root, I'd be good to go.

no. you don't screw up with another user! :D

AFAIK, the '-s' option does not work if you are trying with a non-root user.

cheers,

slackie1000

n0sr 01-03-2005 04:52 AM

I looked at that man page link, did you try the "command" option?

Code:

su --command=passwd
Might try that, but as I read the man page it sounds like the command may not be run interactively.

n0sr 01-04-2005 03:48 AM

Quote:

Originally posted by n0xvb
I looked at that man page link, did you try the "command" option?

Code:

su --command=passwd
Might try that, but as I read the man page it sounds like the command may not be run interactively.

OK, I did a test on my system and got this command to work successfully:
Code:

su -c passwd
This is on a Slack system.


All times are GMT -5. The time now is 08:53 AM.