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

4
  • 2
    I've tried several solutions, and this one works like a charm. Commented Mar 18, 2013 at 13:14
  • 1
    When I first downloaded the file I got the OPs error. When I chmod to 400 or 600 I get 'Permission denied (publickey).
    – DrHall
    Commented Feb 21, 2014 at 1:52
  • 1
    @DrHall make sure you're connecting as the ec2-user: ssh -i /path/to/key.pem [email protected]
    – Lukas S.
    Commented Mar 17, 2016 at 2:29
  • @arun Use Linux Command line tool. In Ubuntu version of EC2, we need to use ubuntu@ip instead of ec2-user@ip
    – oscarz
    Commented Sep 18, 2018 at 19:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.