서버:/etc/pam.d # head -1 /etc/issue
SUSE LINUX Enterprise Server 9.4
SERVER:/etc/pam.d # Cat 로그인
#%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