(Quick-note) SSH Keys Permissions
Context
You want to add a SSH Key to your SSH Agent and you get an error Permissions are too open.
❯ ssh-add ~/.ssh/id_rsa @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for '/home/daco/.ssh/id_rsa' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored.
Solution
If your keys need to be only readable by you:
chmod 400 ~/.ssh/id_rsa
If your keys need to be read-writable by you:
chmod 600 ~/.ssh/id_rsa
After that you can add your key
ssh-add ~/.ssh/id_rsa
Could not open connection to your authentication agent
If you get this error
❯ ssh-add ~/.ssh/id_rsa Could not open a connection to your authentication agent.
just eval your agent
eval `ssh-agent`
and then proceed to add your keys.
Comments
Comments powered by Disqus