Ssh

使用來自 mac 的 putty 密鑰進行 ssh 登錄

  • September 22, 2012

我正在嘗試使用我用 putty (Win) 製作的密鑰從 Mac 登錄伺服器。輸出,其中一些如下所示,看起來像是在嘗試,但我沒有密碼,所以當對話框出現時我只是按 Enter,所以我不知道如何讓它接受空白密碼。我知道它可以在我的 Win 機器上執行,沒有密碼或密碼。

debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
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: Trying private key: /Users/michael/.ssh/b.ppk
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
debug2: bad passphrase given, try again...
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
debug2: bad passphrase given, try again...
debug2: no passphrase given, try next key
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

您需要將您的 Putty 私鑰 (.ppk) 轉換為類似於標準 SSH 密鑰的東西 -puttygen可以為您執行此操作(參見此連結,或向 Google 詢問有關 puttygen 的資訊…)

Stack Overflow 的這篇文章給出了一個關於使用 OSX 終端將 PEM 密鑰轉換為 PPK 的答案:

sudo port install putty
puttygen privatekey.ppk -O private-openssh -o privatekey.pem

引用自:https://serverfault.com/questions/287993