I tried to change root's shell with chsh command, but now I get an error when I try to connect as root with sudo -i.

$ sudo -i
sudo: /usr/bin/bash: command not found

What do I have to modify to get the bash shell?


Assuming that you have not modified the path or created symlink, the default path to the bash binary is /bin/bash, not /usr/bin/bash.

The error is occurring because you have set the root's shell as /usr/bin/bash in /etc/passwd like:


You need to change that to /bin/bash:

sudo usermod -s /bin/bash root

or do:

sudo vipw

and make the modifications manually.

You can obviously choose any other shell of your choice, just make sure that the path is correct. A common place to look for shell paths is /etc/shells file which contains the full paths to all the valid login shells on the system.

| improve this answer | |
  • Thanks for your answer. In the same time, I noticed I could modify the path with sudo emacs /etc/passwd – Sandra Ross Nov 30 '16 at 3:40
  • 4
    @SandraRoss If you are confident you can obviously do that. But i would suggest vipw as it will do the sanity checkings (e.g. syntax) over the changes to make sure everything is in place. – heemayl Nov 30 '16 at 3:43
  • 1
    If you don't want to usse vipw, you can check the integrity of /etc/passwd with pwck – ohno Nov 30 '16 at 9:00

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.