-2

I have a public key file say dummy.pem and i copied this to another computer from where i need to access my EC2 instance. But it says

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for 'dymmy.pem' 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: dummy.pem
Permission denied (publickey).

so why this file is not working in my new computer.?

3 Answers3

4

Change your file permission to 400 (chmod 400 dymmy.pem) . The message clearly says that the file permissions are too open.

sandeep
  • 56
  • 1
1

You also have to set the permissions of your ~/.ssh folder to 700, or it will complain again (see here).

chmod 600 ~/.ssh/dummy.pem
chmod 700 ~/.ssh
0

If you are not clear with that message most probably your are not clear with Linux File permission in general, so I recommend you to start with this

Basically it says that anyone have read access to this file, which expose you to file copy by anyone accessing your system. And in that case connect to the server.

As explained in the answer earlier, another way of doing the same, which may be easier to understand, but a bit longer, is to do it like that : chmod go-r dummy.pem (remove read permission to g(group) and o(other)), and chmod u-w dummy.pem (remove write permission to u(user))

$ touch test
$ chmod 644 test
$ ls -lha test
-rw-r--r-- 1 user group 0 avril 21 10:54 test
$ chmod go-r test
$ ls -lha test
-rw------- 1 user group 0 avril 21 10:54 test
$ chmod u-w test
$ ls -lha test
-r-------- 1 user group 0 avril 21 10:54 test
Florent
  • 308
  • 2
  • 7