OS version:Red Hat Enterprise Linux Server release 6.4
Kernel version:2.6.32-358.el6.x86_64
-------------------------------------------------------------------------
準備工作:
[root@Zhai tmp]# grep PrintLastLog /etc/ssh/sshd_config
#PrintLastLog yes
[root@Zhai tmp]# echo "PrintLastLog no" >> /etc/ssh/sshd_config
驗證silent:
[root@Zhai ~]# vi /etc/pam.d/sshd
#%PAM-1.0
auth required pam_permit.so
account required pam_unix.so
session required pam_lastlog.so silent
[root@Zhai ~]# > /var/log/lastlog ;ll /var/log/lastlog
-rw-r--r--. 1 root root 0 Dec 4 00:57 /var/log/lastlog
驗證never:
#%PAM-1.0
auth required pam_permit.so
account required pam_unix.so
session required pam_lastlog.so never
-rw-r--r--. 1 root root 0 Dec 4 01:01 /var/log/lastlog
驗證nodate:
#%PAM-1.0
auth required pam_permit.so
account required pam_unix.so
session required pam_lastlog.so nodate
驗證noterm:
#%PAM-1.0
auth required pam_permit.so
account required pam_unix.so
session required pam_lastlog.so noterm
驗證nohost:
#%PAM-1.0
auth required pam_permit.so
account required pam_unix.so
session required pam_lastlog.so nohost
驗證inactive(auth):
#%PAM-1.0
# inactive:Invalid for root
auth required pam_permit.so
auth required pam_lastlog.so inactive=3
account required pam_unix.so
session required pam_loginuid.so
驗證inactive(account):
#%PAM-1.0
# inactive:Invalid for root
auth required pam_permit.so
account required pam_lastlog.so inactive=3
account required pam_unix.so
session required pam_loginuid.so
The detailed information:man pam_lastlog