linux - change shell of a user from /bin/false to another
2014-07
I made a mistake of change the root shell to /bin/false, but when I want to change it back, I always got error
sudo chsh -s /bin/bash root
[sudo] password: <input current user password>
password: <input root password>
chsh: PAM: Authentication failure
You can modify the file /etc/passwd
if chsh doesn't work, by replacing the line
root:x:0:0:root:/root:/bin/false
to
root:x:0:0:root:/root:/bin/bash
Try:
sudo vigr
In the editor, change root's shell back to /bin/bash (It should be the last field on the first line)
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?
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.)
Use the Ubuntu install disk to boot the live session.
Mount the root ('/') partition on the harddisk (make sure it's writable).
edit '[HD mount point]/etc/passwd' (eg /media/sda1/etc/passwd),
root should be the first line, just correct the login shell which will be the last entry on the line.
Unmount harddisk. Remove CD. Reboot