- 代碼: 選擇全部
auth required pam_tally.so no_magic_root
account required pam_tally.so deny=3 no_magic_root
Then you need to create 『/var/log/faillog』 and set it to read/write only by root:
- 代碼: 選擇全部
# touch /var/log/faillog
# chmod 600 /var/log/faillog
You can type 『pam_tally --help』 as root to learn about its usage.
To reset the tally for a user and unlock his account, type 『pam_tally --user username --reset』.
Examples:
- 代碼: 選擇全部
cyj@PBG4:~$ cat /etc/pam.d/common-auth
#
auth required pam_unix.so nullok_secure
auth required pam_tally.so no_magic_root
account required pam_tally.so deny=1 no_magic_root
- 代碼: 選擇全部
Debian GNU/Linux 3.1 PBG4 tty1
PBG4 login: cyj
Password:
Login incorrect
PBG4 login: cyj
Password:
Login incorrect
PBG4 login: cyj
Password:
Authentication failure
- 代碼: 選擇全部
Debian GNU/Linux 3.1 PBG4 tty1
PBG4 login: root
Password:
PBG4:~# pam_tally --user cyj
User cyj (1000) has 3
PBG4:~# pam_tally --user cyj --reset=0
User cyj (1000) had 3
PBG4:~# pam_tally --user cyj
User cyj (1000) has 0
PBG4:~#
- 代碼: 選擇全部
Debian GNU/Linux 3.1 PBG4 tty1
PBG4 login: cyj
Password:
cyj@PBG4:~$
See Also:
http://www.kernel.org/pub/linux/libs/pa ... -PAM-html/
http://www.kernel.org/pub/linux/libs/pa ... tally.html