chsh: PAM authentication failed
i want to change default shell env
and run chsh -s /bin/zsh
as root user,
but a error message appeared: chsh: PAM authentication failed
.
i find this thread http://ubuntuforums.org/showthread.php?t=1702833
but the answer did not solve my problem
any help would be appreciated
this is the content of /etc/pam.d/chsh
#
# 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.
auth required pam_shells.so
# This allows root to change user shell without being
# prompted for a password
auth sufficient pam_rootok.so
# The standard Unix authentication modules, used with
# NIS (man nsswitch) as well as normal /etc/passwd and
# /etc/shadow entries.
@include common-auth
@include common-account
@include common-session
this is the content of /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/tmux
/usr/bin/screen
/bin/zsh
/usr/bin/zsh
i find that i used to run chsh -s zsh
this will change first line of /etc/passwd
as
root:x:0:0:root:/root:zsh
and chsh
will ask for password whaterver you try
i just edit /etc/passwd
file manually, and everything is ok.
stupid mistake and thanks for your replies
Solution 1:
Check your /etc/shells file and add /bin/zsh to file if this line does not exists.
Solution 2:
Check your /etc/passwd
. In my case I had specified an invalid shell with chsh
previously and that's what was causing the problem.
I changed it from zsh
as the shell to /bin/zsh
and that made the problem go away for me.