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. – NetworkKingPin Mar 21 '16 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 Mar 21 '16 at 7:52
  • Glad to have Helped. – NetworkKingPin Mar 21 '16 at 7:56

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


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.

  • It's seems to incorrectly read the incorrect shell as a part of the command: 'Cannot execute zsh' – cjsimon Mar 21 '16 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 Mar 21 '16 at 7:11
  • /etc/shells is read only without root permissions – cjsimon Mar 21 '16 at 7:36
  • Course it is. Crap. – Paul Mar 21 '16 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.