
我最近設定了一台新的 Synology NAS,並嘗試在新系統上複製我的公鑰 SSH 存取權(但未成功)。我確定:
- 我的本地 SSH 配置使用相同的私鑰登入兩個 Synology 系統
- 兩個 Synology 系統在 .ssh/authorized_keys 中具有相同(對應)的公鑰
- /etc/ssh/sshd_config 在兩個 Synology 系統上同步(即允許 PubKeyAuthentication),並且服務已重新啟動以確保使用正確的設置
- 兩個 Synology 系統上的 .ssh/ 和authorized_keys 權限都已正確設定(700 和 600)
在舊 Synology 上,ssh -vvv 產生
debug1: Offering public key: /Users/xxx/.ssh/synology_key RSA SHA256:xxxx explicit
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: /Users/xxx/.ssh/synology_key RSA SHA256:xxxx explicit
但在新的密鑰上,相同的密鑰被拒絕
debug1: Offering public key: /Users/xxx/.ssh/synology_key RSA SHA256:xxxx explicit
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey,password).
使用我的密碼進行 SSH 登入在兩個系統上都有效。我還可以檢查什麼來調試?謝謝!
答案1
問題已解決:我的使用者在新 Synology 系統上的主目錄具有不正確的權限(s.https://blog.aaronlenoir.com/2018/05/06/ssh-into-synology-nas-with-ssh-key/)。