在哪裡可以查看 SSHD 的成功登入嘗試?

在哪裡可以查看 SSHD 的成功登入嘗試?

我熟悉使用來log show | grep 'sshd: error: PAM: authentication error for $user from $ip_address'查看來自不同 IP 位址的失敗登入嘗試。

每當成功建立並驗證 SSH 連線時是否會寫入等效日誌(理想情況下它將包含有關客戶端 IP 位址的資訊)。

我查看了我的日誌文件,似乎沒有記錄成功登入的日誌。

答案1

成功的 SSH 登入將使用以下命令登入/var/log/auth.log

sshd[20007]: Accepted password for username from 192.0.2.123 port 60979 ssh2
sshd[20007]: pam_unix(sshd:session): session opened for user username by (uid=0)
systemd-logind[613]: New session 12345 of user username.

或者,如果是公鑰身份驗證:

sshd[20008]: Accepted publickey for username from 192.0.2.123 port 50460 ssh2

相關內容