Ubuntu: Accidentally changed root user to nonexistent shell

chshrootshellUbuntuuser-accounts

I tried to change my user's shell, but used "sudo chsh", and changed the root shell to "bash" instead of "/bin/bash". Now when I try to change it I get "chsh: PAM authentication failed" and it seems like other things aren't working, either.

~$ sudo su
Cannot execute bash: No such file or directory

This happens with recovery mode, too. What do I do to change it to something usable?

Best Answer

If you are able to login using your regular user, just change the root users shell directly:

sudo gedit /etc/passwd

Find the line for you root user, usually the first one, and change the last part from

...:bash

to

...:/bin/bash

And you should be good to go.

(NB: Replace gedit with whatever editor you fancy.)

Related Question