How to Convert PPK (putty) to PEM File using Command

3
(1)

It was necessary to make some changes on the Amazon AWS EC2 server, the client provided me with a ppk (PuTTY private key file) file to access the server via the ssl. But, since I am a Debian user, this file does not suit me. Therefore, I converted it to pem-format using the following commands:

First 1, install tools

sudo apt-get install putty-tools

Step 2, Now, convert the ppk file to pem file using puttygen command line tool.

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

Step3, Change the .pem file permissions. Set the read-only permissions to the owner of the file, remove any permission to group and other. Otherwise ssh will refuse this key for use.

$ chmod 400 server.pem

Step 4, Finally, connect to your remote Linux server with ssh using this pem key

ssh -i server.pem [email protected]

P.S. For Amazon AWS. Verify that you are connecting with the appropriate user name for your AMI

The appropriate user names are as follows:

  • For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user.
  • For a CentOS AMI, the user name is centos.
  • For a Debian AMI, the user name is admin or root.
  • For a Fedora AMI, the user name is ec2-user or fedora.
  • For a RHEL AMI, the user name is ec2-user or root.
  • For a SUSE AMI, the user name is ec2-user or root.
  • For an Ubuntu AMI, the user name is ubuntu.
  • Otherwise, if ec2-user and root don’t work, check with the AMI provider.

P.P.S. To avoid problems. Use Public DNS instance name instead of Public IP

Similar Posts:

1,732

How useful was this post?

Click on a star to rate it!

Average rating 3 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

Scroll to Top