Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EC2 Ubuntu Instance - UNPROTECTED PRIVATE KEY FILE

I just created an Ubuntu instance on EC2, but when I try and SSH into the machine, I get:

UNPROTECTED PRIVATE KEY FILE!   permissions 0644 for 'xxxxx.pem' are too open. It is recommended that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: xxxxx.pem Permission denied (publickey). 

In creating the key, you only enter a name (without the option of adding a password).

How can I SSH into the machine without this warning popping up?

like image 829
Emile Avatar asked Apr 10 '12 14:04

Emile


People also ask

How do I fix unprotected private key file error?

In order to solve the "Warning: Unprotected Private Key File" error in AWS EC2, update the permissions of the private key file to only allow read access from the current user, e.g. chmod 600 ec2-private-key. pem . Open your terminal in the directory where your private key is located and run the chmod command. Copied!

Where are private keys stored in EC2?

You can use a private key to access your instances securely. You store the private key in your local computer and EC2 instances store the public key. EC2 instances get the public key contents from the metadata of the instance and store it in a file named “authorized_keys” under “/home/ec2-user/. ssh” directory.

How do I make a PEM file accessible?

pem key file, then use chmod 600 instead of chmod 400 because that will allow the owner read-write access and not just read-only access.

How do you login to EC2 instance if private key is lost?

When you use EC2Config or EC2Launch to reset a lost password, you must use its key pair to retrieve the administrator password. If you've lost the key pair, you can create an AMI of the existing instance, and then launch a new instance. You can then select a new key pair by following the instance launch wizard.


1 Answers

Private keys must be readable only by the owner ..

Do chmod 400 xxxxx.pem on the machine from which you're connecting

like image 157
scibuff Avatar answered Sep 22 '22 06:09

scibuff