Reputation: 14925
I have a private key file named awskey.ppk and a host ip address (let's call this 123.45.678.910
I am trying to connect to the EC2 instance using the command line command -
ssh -i /Users/ashishagarwal/EC2/awskey.ppk [email protected]
This is giving me the error:
Permissions 0644 for '/Users/ashishagarwal/EC2/awskey.ppk' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: /Users/ashishagarwal/EC2/awskey.ppk Permission denied (publickey).
How do I fix this ?
Upvotes: 2
Views: 5886
Reputation: 4455
There is a bit extra work as we need to convert .ppk to .pem file first. Instructions for Macbook: Firtly, we need to install Homebrew and Putty:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install putty
Then converting .ppk to .pem like this:
puttygen yourFileLocation/your_aws.ppk -O private-openssh -o yourFileLocation/your_aws.pem
After that, set permission to limit access:
chmod 400 yourFileLocation/your_aws.pem
Now you can connect and login to to your server instance like below:
ssh -i yourFileLocation/your_aws.pem [email protected]
For Windows users you can access and download Putty from here.
Upvotes: 0
Reputation: 10053
The private key files should have file permissions as 400, which could be changed using
chmod 400 file_path
Make sure you are using the correct user name like ec2-user
or ubuntu
. If you are using unix based system then use .ppk key.
Upvotes: 4
Reputation: 19573
Two things.
chmod
will fix your permissions. The file needs to be changed to 600 or 400.ppk
format is used by putty, need to convert the key to pem encoded format. You can use the putty keygen tool for this.Upvotes: 6
Reputation: 9581
I'm assuming you are using Mac or Unix (based on the command line).
Run this command:
chmod 400 /Users/ashishagarwal/EC2/awskey.ppk
Then run your SSH command again, and it should work.
Upvotes: 3