找了好多博客绕了一大圈发现其实问题非常简单,查看一下以下命令行修改一下即可。甚至不用改服务器上的公钥。
ssh-keygen
will not export a private key in pem format, but it will convert an existing openssh private key to pem format, overwriting the original. All you have to do is edit the password.
The command to convert your ~/.ssh/id_rsa
file from OpenSSH format to SSH2 (pem) format is:
ssh-keygen -p -f ~/.ssh/id_rsa -m pem
Then supply the (old) and new passphrase at the prompt. They can be the same, or even both be blank. Or you can supply them on the command-line using the -P
(old passphrase) and -N
(new passphrase) options. For example, if the passphrase is blank, and you want to keep it that way:
ssh-keygen -p -P '' -N ''-f ~/.ssh/id_rsa -m pem