Ubuntu 16.04 中的 sshd - 登入需要很長時間

Ubuntu 16.04 中的 sshd - 登入需要很長時間

過去我曾多次看到 ssh 登入需要幾秒鐘的時間。我總覺得這樣不合適。當我用 Xubuntu 16.04 重新安裝工作站後,這種效果變得非常具有破壞性。在同一區域網路內的兩個工作站之間,ssh登入需要10多秒的時間。之後,一切都很快。

這些機器可以透過我的路由器立即透過 dns 找到彼此。不過,我也嘗試過UseDNS no。我也嘗試了GSSAPIAuthentication no網路上找到的方法。兩者都沒有效果。

我透過公鑰進行身份驗證。

這是 ssh 客戶端的偵錯輸出片段:

debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/pino/.ssh/ids/heisterkamp/22/pino
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
debug2: input_userauth_pk_ok: fp XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
debug3: sign_and_send_pubkey: RSA XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to heisterkamp ([fd00::8d93:c17b:595a:347f]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: exec

現在這個東西已經「休眠」了 10 秒。之後,又繼續這樣:

debug1: client_input_global_request: rtype [email protected] want_reply 0
debug3: receive packet: type 91
debug2: callback start
debug2: x11_get_proto: /usr/bin/xauth  list :0.0 2>/dev/null
debug1: Requesting X11 forwarding with authentication spoofing.
debug2: channel 0: request x11-req confirm 1
debug3: send packet: type 98
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IPV6_TCLASS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug1: Sending environment.
...

有誰知道等待時間的原因是什麼?

編輯:還有一些細節值得一提:

  • 當我使用我的工作站登入同一網路中的其他一些 Debian 電腦時,只需要一秒鐘。
  • 我已將 pam_mount 配置為在登入時安裝 luks 加密的磁碟區。但是,在我的情況下,該磁碟區已經安裝。即使未安裝,安裝也只需約 3 秒。

答案1

同樣的問題。請注意,我可以在 10 秒延遲後看到:“無法啟動服務「org.freedesktop.login1」:超時“ 在 auth.log 中

解決方案:

systemctl restart systemd-logind

找到了這裡

答案2

在我的例子中,這解決了掛在「debug1:pledge:exec」的問題:

apt install --reinstall systemd

相關內容