OS X SSH 不斷要求輸入密碼

OS X SSH 不斷要求輸入密碼

我使用公鑰/私鑰透過 ssh 從 Linux 電腦連接到多台 Mac。

每個 ac、從 10.5 到 10.9 的不同作業系統以及公鑰工作的設定都是相同的。只有其中一個運行 OS X 10.9.5,不斷詢問使用者密碼而不是使用公鑰。

實際上,任何機器都無法使用公鑰進行訪問

ssh -vvv 是:

...
debug1: Authentications that can continue: publickey,keyboard-interactive
debug3: start over, passed a different list publickey,keyboard-interactive
debug3: preferred 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 DSA public key: /Users/akeeem/.ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /Users/akeeem/.ssh/id_rsa
debug3: no such identity: /Users/akeeem/.ssh/id_rsa: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug2: we sent a keyboard-interactive packet, wait for reply
debug2: input_userauth_info_req
debug2: input_userauth_info_req: num_prompts 1
Password:

我應該檢查什麼來確保公鑰可以運行?

答案1

您必須確保 ssh 伺服器已設定為接受公鑰驗證。

然後,如果訊息錯誤表明我們沒有發送資料包,則停用方法意味著 ssh 伺服器在存取authorized_keys 檔案時遇到一些問題。您應該檢查:

authorized_keys 的語法是正確的。 .ssh目錄和authorized_keys檔案的權限正確。好的選擇是使用 ssh-copy-id 將公鑰檔案複製到伺服器,它將建立具有必要權限的所有檔案和目錄。

ssh-copy-id -i /home/使用者名稱/.ssh/id_rsa.pub 使用者名稱@伺服器

相關內容