不接受 SSH 登錄,並且 ssh 登錄嘗試之間沒有延遲
當 ssh’ing 到我的伺服器(執行 Arch 的 RaspPi)時,它不接受我的密碼(我 98% 確定這是正確的),並且之前通常的延遲
Permission denied, please try again.
不存在。否則,伺服器執行良好。我嘗試使用預設值
/etc/ssh/ssh_config
,/etc/ssh/sshd_config
但無濟於事。用root登錄是一樣的,在再次詢問密碼之前沒有延遲。我沒有任何顯示器可以連接到 Pi,因此無法檢查 journalctl 和類似內容,但我可以物理訪問 sd 卡。
如前所述,我已將 ssh_config 和 sshd_config 設置為預設值,並且對於為什麼 openssh 會這樣表現感到完全困惑。
這是
ssh -v
ip 收回的 root(我自己沒有看到任何異常):OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to ****.com [**.***.***.**] port 22. debug1: Connection established. debug1: key_load_public: No such file or directory debug1: identity file /home/****/.ssh/id_rsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/****/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/****/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/****/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/****/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/****/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/****/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/****/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.1 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1 debug1: match: OpenSSH_7.1 pat OpenSSH* compat 0x04000000 debug1: Authenticating to *********.com:22 as 'root' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:TPjpBFxCBTcJR+zUv0KRTd3ImVCWzAk8D2U++W422oA debug1: Host '******.com' is known and matches the ECDSA host key. debug1: Found key in /home/****/.ssh/known_hosts:3 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Trying private key: /home/****/.ssh/id_rsa debug1: Trying private key: /home/****/.ssh/id_dsa debug1: Trying private key: /home/****/.ssh/id_ecdsa debug1: Trying private key: /home/****/.ssh/id_ed25519 debug1: Next authentication method: password root@*******.com's password: debug1: Authentications that can continue: publickey,password Permission denied, please try again. root@******.com's password: debug1: Authentications that can continue: publickey,password Permission denied, please try again. root@******com's password:
感謝@ams,我可以訪問日誌,這似乎是 PAM 的問題。我在 中禁用了 pam-authentication
sshd_config
,並且能夠以 root 身份登錄。在那裡我可以進行系統更新(其中 pam 有一個新版本),現在可以以我的普通使用者身份登錄。但是,由於某種原因,通過 ssh 進行登錄嘗試之間的暫停仍然不存在(這顯然是一個嚴重的安全問題),但如果需要,我會發布一個單獨的問題。
我相信您可以
journalctl
在任何電腦上使用從 SD 卡讀取日誌。有用於此目的的--root
選項--directory
。如果您不在 PC 上使用 Arch,那麼 LiveCD/USB 應該可以正常工作。
@Brean 的猜測
PermitRootLogin
是我的猜測,但你沒有提供足夠的資訊讓我具體說出來。如果允許 root 登錄,但密碼仍然不被接受,那麼您可以手動編輯 SD 卡上的密碼,但生成 ssh 密鑰並將其粘貼到
/home/root/.ssh/authorized_keys
.