29

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?

1

1 Answer 1

80

Private keys must be readable only by the owner ..

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

Sign up to request clarification or add additional context in comments.

4 Comments

I've tried several solutions, and this one works like a charm.
When I first downloaded the file I got the OPs error. When I chmod to 400 or 600 I get 'Permission denied (publickey).
@DrHall make sure you're connecting as the ec2-user: ssh -i /path/to/key.pem [email protected]
@arun Use Linux Command line tool. In Ubuntu version of EC2, we need to use ubuntu@ip instead of ec2-user@ip

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.