~# cat /etc/pam.d/postlogin
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
session [success=1 default=ignore] pam_succeed_if.so service !~ gdm* service !~ su* quiet
session [default=1] pam_lastlog.so nowtmp showfailed
session optional pam_lastlog.so silent noupdate showfailed
这里showfailed选项负责有关登录失败的消息。
注意:在我的机器上默认没有安装 authconfig,所以我不太担心更改被破坏。
只需删除此选项即可禁用所有用户的消息。AFAIK 每用户 PAM 配置有点傻,这就是我想出的:
# cat /etc/pam.d/postlogin
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
session [success=ignore default=3] pam_succeed_if.so user in that_non_root_user
session [success=1 default=ignore] pam_succeed_if.so service !~ gdm* service !~ su* quiet
session [default=4] pam_lastlog.so nowtmp
session [default=3] pam_lastlog.so silent noupdate
session [success=1 default=ignore] pam_succeed_if.so service !~ gdm* service !~ su* quiet
session [default=1] pam_lastlog.so nowtmp showfailed
session optional pam_lastlog.so silent noupdate showfailed
假设 CentOS 7。
这里
showfailed
选项负责有关登录失败的消息。注意:在我的机器上默认没有安装 authconfig,所以我不太担心更改被破坏。
只需删除此选项即可禁用所有用户的消息。AFAIK 每用户 PAM 配置有点傻,这就是我想出的: