Ssh
使用 SSH 密鑰和 PuTTY for Windows 時,主機不斷詢問密碼
我正在使用PuTTY for Windows連接到 dreamcompute-VPS(dreamhost)。在 dreamcompute 面板,我創建了一個私鑰並下載了它,一個**.pem文件。使用PuTTYgen**,我將此文件轉換為**.ppk作為 SSH2-RSA。所以,我下載了 Pageant.exe並添加了這個.ppk文件。在PuTTY.exe中,我將從 dreamcompute 面板獲取的浮動 IP作為主機名,將****使用者名設置
Connection->Data
為dhc-user**,最後將**.ppk**文件載入到Connection->SSH->Auth
. 問題是當我打開連接時,身份驗證過程不斷要求我輸入密碼。我錯過了什麼?不應該只有使用者名和密鑰嗎?日誌:
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2015.07.21 15:08:26 =~=~=~=~=~=~=~=~=~=~=~= Event Log: Writing new session log (SSH raw data mode) to file: C:\Users\User\Desktop\putty.log Event Log: Looking up host "173.236.254.75" Event Log: Connecting to 173.236.254.75 port 22 Event Log: Server version: SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 Event Log: We believe remote version has SSH-2 channel request bug Event Log: Using SSH protocol version 2 Event Log: We claim version: SSH-2.0-PuTTY_Release_0.64 Event Log: Doing Diffie-Hellman group exchange Event Log: Initialised AES-256 SDCTR client->server encryption Event Log: Initialised HMAC-SHA-256 client->server MAC algorithm Event Log: Initialised AES-256 SDCTR server->client encryption Event Log: Initialised HMAC-SHA-256 server->client MAC algorithm Event Log: Reading private key file "C:\Users\User\Desktop\private.ppk" Event Log: Pageant is running. Requesting keys. Event Log: Pageant has 1 SSH-2 keys Event Log: Pageant key #0 matches configured key file Event Log: Trying Pageant key #0 Event Log: Server refused our key
主要問題在這裡:
事件日誌:伺服器拒絕了我們的密鑰
這可能是由於對 的權限不正確
.ssh/authorized_keys
或密鑰無效造成的。可以使用以下方法解決權限:
chmod -R go-rwx ~/.ssh
另一種可能性是錯誤的密鑰。您必須在 ~/.ssh/authorized_keys 上附加公鑰,而不是私鑰。檢查是否有正確的密鑰。