PAM 设置错误:成功登录记录为失败

PAM 设置错误:成功登录记录为失败

服务器:/etc/pam.d # head -1 /etc/issue

SUSE LINUX Enterprise Server 9.4

SERVER:/etc/pam.d # 猫登录

#%PAM-1.0
auth requisite  pam_unix2.so    nullok     #set_secrpc
auth required   pam_securetty.so
auth required   pam_nologin.so
#auth    required   pam_homecheck.so
auth required   pam_env.so
auth required   pam_mail.so
#account required pam_tally.so deny=5 reset no_magic_root
account required    pam_unix2.so
password required   pam_pwcheck.so  nullok md5
password required   pam_unix2.so    nullok use_first_pass use_authtok md5
session required    pam_unix2.so    none     # debug or trace
session required    pam_limits.so

服务器:/etc/pam.d # cat sshd

#%PAM-1.0
auth     required   pam_tally.so no_magic_root
auth     required       /lib/security/pam_unix.so   # set_secrpc
auth     required       /lib/security/pam_nologin.so
auth     required       /lib/security/pam_env.so
#account required pam_tally.so deny=5 reset no_magic_root
account  required       /lib/security/pam_unix.so
password required       /lib/security/pam_pwcheck.so
password required       /lib/security/pam_unix.so       use_first_pass use_authtok md5
session  required       /lib/security/pam_unix.so   none # trace or debug
session  required       /lib/security/pam_limits.so
SERVER:/etc/pam.d # 
SERVER:/etc/pam.d # 

服务器:/etc/pam.d#faillog -u pamtest

Username   Failures  Maximum  Latest
pamtest           0        5  Thu Aug 29 13:35:15 +0200 2013 on localhost

服务器:/etc/pam.d # ssh pamtest@localhost

pamtest@localhost's password: 
Last login: Thu Aug 29 13:35:15 2013 from localhost
pamtest@SERVER:~> exit
logout
Connection to localhost closed.
SERVER:/etc/pam.d # faillog -u pamtest
Username   Failures  Maximum  Latest
pamtest           1        5  Thu Aug 29 13:39:40 +0200 2013 on localhost
SERVER:/etc/pam.d # 

问:为什么系统将登录成功记录为登录失败? “UsePAM yes”位于 sshd_config 中。 (例如:sshd 文件中的行顺序是否重要?)

答案1

“pam_tally.so”应包含在“account”部分和“auth”部分中。这将清除成功登录后的失败尝试计数。将以下行添加到 /etc/pam.d/sshd:

account required pam_tally.so

相关内容