我想更改默认的 shell env
并chsh -s /bin/zsh
以root用户身份运行,
但是出现了一条错误消息:chsh: PAM authentication failed
。
我发现这个线程http://ubuntuforums.org/showthread.php?t=1702833
但答案并没有解决我的问题
任何帮助,将不胜感激
这是/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
Run Code Online (Sandbox Code Playgroud)
这是/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
Run Code Online (Sandbox Code Playgroud)
我发现我曾经运行过chsh -s zsh
这会改变/etc/passwd
as 的第一行
root:x:0:0:root:/root:zsh
Run Code Online (Sandbox Code Playgroud)
chsh
无论您尝试什么,都会要求输入密码
我只是/etc/passwd
手动编辑文件,一切正常。
愚蠢的错误,感谢您的回复
检查你的/etc/passwd
。就我而言,我chsh
之前指定了一个无效的 shell,这就是导致问题的原因。
我将它从zsh
shell 更改为/bin/zsh
,这使我的问题消失了。
小智 5
如果此行不存在,请检查您的 /etc/shells 文件并将 /bin/zsh 添加到文件中。