目前,我在 ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-77-generic x86_64) 上的 lastlog 没有显示所有 ssh 连接。这对我来说似乎有点奇怪。
我的部署用户通过 jenkins ssh:notty 连接。此连接记录在 /var/log/auth.log 中
Jun 9 16:40:03 hostname sshd[31691]: Accepted publickey for deploy from 192.168.1.129 port 38718 ssh2: RSA SHA256
Jun 9 16:40:03 hostname sshd[31691]: pam_unix(sshd:session): session opened for user deploy by (uid=0)
Jun 9 16:40:03 hostname systemd-logind[2009]: New session 6764 of user deploy.
Jun 9 16:40:03 hostname systemd: pam_unix(systemd-user:session): session opened for user deploy by (uid=0)
Jun 9 16:40:04 hostname sshd[31691]: pam_unix(sshd:session): session closed for user deploy
但是 lastlog 没有列出它们:
username@hostname:~# sudo last
username pts/0 192.168.1.25 Fri Jun 9 16:39 still logged in
username pts/0 192.168.1.25 Fri Jun 9 16:39 - 16:39 (00:00)
username pts/0 192.168.1.25 Fri Jun 9 16:37 - 16:38 (00:01)
username pts/0 192.168.1.25 Fri Jun 9 16:25 - 16:28 (00:01)
并且 lastlog 告诉我,用户 deploy 从未登录:
deploy **Never logged in**
那么,什么原因可能导致这个问题呢?