0

I installed zsh and changed root shell /bin/bash to /usr/bin/zsh. Then I rebooted and typed sudo su. It said "Cannot execute help: No such file or directory". So, I typed sudo bash. However, when I typed "echo $SHELL", it said the root shell is 'help'. How can I fix this?

  • Yes, that's right. – 홍세정 Feb 8 '18 at 5:57
0

The error message Cannot execute help: No such file or directory indicates that root's login shell has been set to help rather than to a valid shell.

You may fix this by issuing the correct chsh command:

sudo chsh -s /bin/bash root

or by editing root's login record in /etc/passwd. This file must be edited with vipw (never ever directly):

sudo vipw

On most Linux systems, root's entry in the file that opens up in the editor when you use vipw should look something like

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

You should make sure that the last :-delimited field is the correct path to the login shell for root on your system, and change it in the editor if it's not. Then save the file and exit.


Note that there is absolutely no benefit in changing the login shell of root, as you should not find yourself logging in as root or using an interactive root shell for any lengths of time.

Any administrational tasks that you may need to perform on the system may be performed using sudo followed by the command that you need to execute.

There is additionally no need to use su with sudo. This is discussed in the answers to the question Is there ever a good reason to run sudo su?

  • So the questioner did not change the superuser's login shell to the Z shell as the question claims, but at one point ran chsh -s help instead of chsh --help. For more on the subject of changing the superuser's login shell, see unix.stackexchange.com/questions/2640 . – JdeBP Feb 8 '18 at 6:56

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.