6

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?

1 Answer 1

12

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:

root:x:0:0:root:/root:/usr/bin/bash

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.

3
  • Thanks for your answer. In the same time, I noticed I could modify the path with sudo emacs /etc/passwd Nov 30, 2016 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, 2016 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, 2016 at 9:00

You must log in to answer this question.

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