Create a PEM from a PPK file [duplicate]

情到浓时终转凉″ 提交于 2019-12-20 08:39:39

问题


So there are plenty of tutorials on how to convert a PEM to a PPK using puttyGen. However my issue is that my windows machine had the only PEM copy and I converted it into a PPK and deleted it. Now I need to figure out how to convert a PPK into a PEM so that my mac can ssh into the server. I still have access to the server so I could also just make a new key if I had to, anyone know how to convert PPK to PEM?


回答1:


  1. Install PuttyTools

    apt-get install putty-tools
    
  2. Generate a pem file form the ppk

    puttygen server.ppk -O private-openssh -o server.pem  
    

The file server.pem file will be saved on same location




回答2:


If you're on a Mac and you've previously installed Homebrew, from Terminal:

$ brew install putty
$ puttygen server.ppk -O private-openssh -o server.pem

The first command was suggested in this comment and the second from Emizen Tech's answer.




回答3:


Try this to install putty-tools

sudo apt install putty-tools
puttygen key.ppk -O private-openssh -o key.pem
ssh -i ~/key.pem {user}@{ip}



回答4:


First, install PuTTY for Mac using

brew install putty

Then, use the following command to convert the .ppk format private key to a standard PEM format private key:

puttygen privatekey.ppk -O private-openssh -o privatekey.pem

Make sure permissions on the private key file are set properly. It should only be readable by the user that owns it.

chmod go-rw privatekey.pem

You can now use the key for logins from scripts and command line with:

ssh -i privatekey.pem user@hostname


来源:https://stackoverflow.com/questions/33273180/create-a-pem-from-a-ppk-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!