標籤:ssh
昨天需要ssh登入某伺服器,但ssh登入緩慢,差不多半分鐘才登入成功,故對其進行追蹤檢查
①、ssh ip -vvv 或 ssh ip -v
用於檢查ssh在哪個位置用時最長
然後發現在Entering interactive session 語句後等待時間最長,超過20秒,說明非ssh登入時密 碼驗證的問題
②、這樣看不出啥問題,故使用starce進行追蹤
starce -o ~/starce_ssh.txt -T ssh ip
cat ~/starce_ssh.txt 發現:
clock_gettime(0x7 /* CLOCK_??? */, {5243451, 134078578}) = 0 <0.000026>
select(7, [3], [], NULL, NULL) = 1 (in [3]) <25.026978>
然而看不懂這個地方,悲催
③、故嘗試查看所登入的伺服器的messages日誌,竟然有重大發現
dbus[7782]: [system] Failed to activate service ‘org.freedesktop.login1‘: timed out
dbus-daemon: dbus[7782]: [system] Failed to activate service ‘org.freedesktop.login1‘: timed out
顯示這個服務逾時了,網上尋找資料,大意如下:
dbus的服務重啟後,systemd-logind服務沒有重啟導致,可以查看systemctl status systemd-logind的狀態,解決方案就是重啟該服務 systemctl restart systemd-logind
參考文檔:http://serverfault.com/questions/707377/slow-ssh-login-activation-of-org-freedesktop-login1-timed-out
一個ssh登入緩慢的問題追蹤記錄