[linux] When you try to sudo su and you can't run / usr / local / bin / zsh

Introduction

I can't find the command in sudo When I tried to set the root user's path by su, it was rejected so I checked

Cause

When I switched from bash to zsh ~~ Did the default shell of root become / usr / local / bin / zsh by mistake ~~, it seems that the cause is that the root shell is not set in the first place

I haven't set the root path, so I can't set the root shell with chsh! </ font>

Actual path


❯ echo $SHELL                                      
/usr/bin/zsh

First change the shell

sudo chsh root -s /usr/bin/zsh

When authentication fails

sudo chsh root -s /usr/bin/zsh
chsh: PAM:Authentication failure

Edit /etc/pam.d/chsh so that you can change the shell.

#
# The PAM configuration file for the Shadow `chsh' service
#

# This will not allow a user to change their shell unless
# their current one is listed in /etc/shells. This keeps
# accounts with special shells from changing them.


#Comment out here
# auth       required   pam_shells.so

You can change it by doing sudo chsh root -s / usr / bin / zsh again in this state. If you can change it, undo the commented out line.

Change root path

$ sudo su -
$ passwd root

Please enter a new UNIX password: xxx
Please re-enter your new UNIX password: xxx
passwd:Password updated correctly

$ exit

Recommended Posts

[linux] When you try to sudo su and you can't run / usr / local / bin / zsh
Linux (for users and su / sudo commands)
Settings when you want to run python-mecab with travis
What to do when you can't bind CaboCha to Python