1

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?

3
  • 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. Commented Mar 21, 2016 at 6:24
  • 1
    The 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.
    – cjsimon
    Commented Mar 21, 2016 at 7:52
  • Glad to have Helped. Commented Mar 21, 2016 at 7:56

2 Answers 2

3

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.

0

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.

4
  • It's seems to incorrectly read the incorrect shell as a part of the command: 'Cannot execute zsh'
    – cjsimon
    Commented Mar 21, 2016 at 7:07
  • For both of these? Yes, I see it does still try to invoke the home shell when you su. Hang on.
    – Paul
    Commented Mar 21, 2016 at 7:11
  • /etc/shells is read only without root permissions
    – cjsimon
    Commented Mar 21, 2016 at 7:36
  • Course it is. Crap.
    – Paul
    Commented Mar 21, 2016 at 7:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .