Tuesday, June 14, 2016

Resolved - Linux - unprotected private key file

When connecting to other systems using SSH in a key based manner you might have situations sometimes where you move your privtae key from one machine to another. For example when you have a new workstation you want your keys on this machine as they match the keys on other systems and the combiantion is needed to make the connection.

When you simply place them on your new machine without any other actions and connect to a remote SSH deamon it can happen that you will see the below message. (might differ slightly).

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0744 for '/home/jlo/.ssh/id_rsa' 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: /home/jlo/.ssh/id_rsa

This is your local machine telling you that your key is not having the appropriate permissions. Or in other words, the permissions on the key are to open and not secure enought. To resolve this you will have to execute a chmod. In our example, a chmod on these two files:

chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa.pub

This should resolve the issue for you and you should be able to connect via SSH in a key based manner without any issues. 

No comments: