Connecting to AWS EC2 instance using Private Key and Host IP
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 ec2user@123.45.678.910
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 ?
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. 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.
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.
链接地址: http://www.djcxy.com/p/38974.html