I accidentally changed my root shell to use a nonexistent shell, and now the root user crashes when I attempt to log in. Since I do not have sudo installed, I can't manually change the shell in etc/passwd. Are there any options in rescue mode that might help me?
-
I would Try using a live disc to fix the root shell. This would probably be your best best. Use a Live boot Cd or Usb.– NetworkKingPinCommented Mar 21, 2016 at 6:24
-
1The live disk worked perfectly. I mounted my drive and used chroot to access it. I was then successfully able to modify the value of the root shell in /etc/passwd from there.– cjsimonCommented Mar 21, 2016 at 7:52
-
Glad to have Helped.– NetworkKingPinCommented Mar 21, 2016 at 7:56
2 Answers
Posting this as the answer to further help those in need.
Use a Live disc in this case any live disc will work.
Mount the Drive and use chroot like @Christoper Simon
stated.
And modify any settings you made that made the Distro Unusable.
First edit /etc/shells
to include a line that matches the shell you have defined for root, such as
/bin/zsh
Just having this present seems to be enough to ignore it.
su -s '/bin/bash' -c 'vi /etc/passwd'
This should hang for a bit while it looks for zsh, then carry on and run bash and execute the command.