'不是私钥'尝试将pem转换为ppk时出错

时间:2015-07-22 05:28:56

标签: ssh private putty public

我试图通过ssh访问我朋友的AWS服务器。他给了我主机名和pem文件。我对此比较陌生,并尝试使用putty连接到登录。对于他在Windows上,他使用PuttyGen将他的pem文件转换为ppk文件。但是在Ubuntu上我找不到puttygen的GUI版本,并试图将pem文件转换为ppk文件,但没有运气。尝试使用

转换它
puttygen myFile.pem -o newFile.ppk

但收到错误

puttygen: unable to load file `myFile.pem': not a private key

我在最后用-O私有选项尝试了相同的命令,但也没有运气。即使我尝试使用带有-m选项的ssh和pem文件本身,它也会要求我提供一个我不知道的密码,而我的朋友说没有密码短语。

我的朋友给了我他的ppk文件,我试图用Putty但它没有用。

1 个答案:

答案 0 :(得分:0)

您可以通过打印公钥来判断私钥是否已加密

加密密钥:

$ ssh-keygen -y -f ~/.ssh/test_key_with_passphrase
Enter passphrase: 
ssh-rsa   AAAAB3NzaC1yc2EAAAADAQABAAABAQC5kB+0TPMDH/OQ6t/ps67DDJvZzAFF4QyqTYFS3K86bmEz5DeIBtB8kgi3a7ecft6/ooeq+WnuyGvInwNY9GqrO3WDbP4joAqAc6waolEIcs8Nb6iNK+Zhv3O0BfAeXnb5aAztGFfzoBKz6MFGw6Haod3BkZiC40/owG11rjwvb7p4mlHsGrjPpBOGMZ66zPBPuEoFDcCDUnpgh9tNww4Wrzcp+jgZM1MP5ylRCiQE/ssgu3G0zZ3H+5YwRN/XNChomXW74W/yBnp5gAqJZNhiuxTaZBDANXAyiqwrysfzYFgzvTDfyf03aysPAMWkWucmMHxnHz5C649ikSLAOK+h

未加密的密钥:

$ ssh-keygen -y -f ~/.ssh/test_key_in_the_clear.pem
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCxNX8DHatQQYw05PHcEvwHwKaqDvZUQWG23uUxQSxEiq1crf2j9dPCfzigKcPxIYarTIJ6yvdP6Kl/ONb+OKM7j6dd8ljO5LOs7dsgA5Tr2gaWyjrjmg767VCN2PB6BJZ9xz+p3SGTdFWtUXYtaEPAGocRx09N9kofpecRbRMlnbfHotyK8canGYzzRfimzk/uDAC/CcpeG3YLphj7zhpRaXhgdu/FKcdiTryqgktlZreJEbefeq3CEBM9kmxvr2uDc+QSVnhbcdutTJ4u4DEop0ZuTREZ2tH2HoAVruiJQ7Nd/VP8jz3SD5ySFBzPGiPcNMQ2mOP0cffm55+3CTwT

一旦你完成了这项工作,那么使用-i ssh进入服务器,如果你使用的是ubuntu,则无需担心使用putty。

修改 这是pem文件通常的样子:

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,0E109A1A0F7582B0D8B5AAAFDAB18C2A

wzvkuSuXTFTSyKvkmU7bytC6xhNGybkcc9FKH6oCFL802ZnJIUWnqIV7x4vXuDxg
zQFggRxnEqJIPv+gNUCdBMqlKal9XqAVAXw6I2bDKJIymg/UB0ODVzqzxhD1w+fD
a1nArpapqfO2Vgfeb0ABv3yNHXNcsLGpv21wR6JY/SskQQflt59MJ3pdc5nFQ3nE
O0AMiI9YH6dLPOtk5HMGR1s55b6SgHkfiaDoIAqRJd8J9Zrg7qDV0oncQmxYT+A/
ye+5OmXVoRP1SskhhmMFbb84GZ5YSpeIXqFCVaH+Uvifzhxc0La53sZEdJw1QUf/
f1ZIgg+Kysir+HX3Cul6LPz60tzjkZrlhGzPBmwcrM1zM1ehzQqU5dKzp3uAjtP0
NUHMAg5TG8dLv7eaKQAPis6f2vYebjzd538sA5O0EpMuNuWk1/CrchrKxS7ii8Sj
LkD/3hIrpXC4UO1AVJq1+OmbXh3LOCiTh2i+hKhFBS2q8V4cCaW5VbQfup8gyn5K
jOstbx+oCH3OsfoG3Tcr75+TKl1m4jXZmFACzEIQeuiWTA58nbFQDDSQJo9AdC6n
eMnT2vLvZQo2Og1fKfaaHSsh/sfqIqDxQhqCZCT7QB4SAB+CtD5QnzaWkHAqMNHv
RjW9rDdM3/oQxXba0eiCa2XBcI+W9ZU1ItjyqfbP7PJIge4r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