WSL 上的 SSH 金鑰身份驗證始終顯示“debug2:我們沒有發送資料包,停用方法”

WSL 上的 SSH 金鑰身份驗證始終顯示“debug2:我們沒有發送資料包,停用方法”

/etc/ssh/sshd_config看起來像這樣:Pastebin.ubuntu.com 鏈接。這是預設的,除了我取消註解授權金鑰、pubkey auth 和listenaddress。

然後我做了ssh-copy-id -i ~/.ssh/id_ed25519 user@host,之後我可以看到該authorized_keys文件在那裡並且是正確的。然後我sshd--full-restart鑰匙重新啟動。之後我在嘗試連線時總是得到以下資訊:

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 public key: ED25519 SHA256:Te7bTBJr1zQqeagqlCYl6Vsc19UF1qc67dSRRfBJ6J0 /home/jus/.ssh/id_ed25519
debug3: send_pubkey_test
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
debug1: Trying private key: /home/jus/.ssh/id_rsa
debug3: no such identity: /home/jus/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /home/jus/.ssh/id_dsa
debug3: no such identity: /home/jus/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/jus/.ssh/id_ecdsa
debug3: no such identity: /home/jus/.ssh/id_ecdsa: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
[email protected]'s password: 

如果我停用密碼身份驗證,我的權限會立即被拒絕。而且我從來沒有被要求輸入密鑰的密碼。

為了測試,我在虛擬機器(Xubuntu)上對 sshd 執行了完全相同的步驟,一切正常。我使用了相同的金鑰,並且可以從 WSL ssh 用戶端進行連線。

相關內容