ssh “permissions are too open”

I got the following error from ssh

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/azzamjiul/.ssh/some-name-file.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

Solutions

The keys need to be read-writable only by you:

chmod 600 ~/.ssh/some-name-file.pem

Alternatively, the keys can be only readable by you (this also blocks your write access):

chmod 400 ~/.ssh/id_rsa

600 appears to be better in most cases, because you don’t need to change file permissions later to edit it.

Leave a Comment