Getting "Warning: unprotected private key file!" error message while attempting to import SSH key
HerokuSsh KeysHeroku Problem Overview
Can someone explain this to me please and what I can do to sort out my permissions issue. It seems to be stopping me from getting the authenticity of host heroku
and fixing my keys issues.
david@daniel-Inspiron-531:~$ ssh-add david/.ssh/id_rsa
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0775 for 'david/.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.
david@daniel-Ins
Heroku Solutions
Solution 1 - Heroku
I would recommend you to re create a set of keys using
ssh-keygen -t rsa -C '<email>'
for a more secure system. Else changing the permissions to something less open would do.
To change permissions, use
chmod 400 ~/.ssh/id_rsa
Solution 2 - Heroku
Simply reset permissions to your key files to defaults
sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 600 ~/.ssh/id_rsa.pub
Solution 3 - Heroku
Just change the permission of the /.ssh/id_rsa file to 400
#chmod 400 ~/.ssh/id_rsa
This won't make others or from any group members to modify the file.
Solution 4 - Heroku
If you are using WSL, you can copy file.pem to ~/.ssh/
Copy file .pem
cp file.pem ~/.ssh/
Change permissions:
chmod 600 ~/.ssh/file.pem
Done, try again with your ssh-add
eval `ssh-agent -s`
ssh-add ~/.ssh/file.pem
Solution 5 - Heroku
You should change the owner of the file(which contains the private key)to your username with full access. and then remove the other usernames that have access to that file.
Right Click on the file which contains the private key and clicks on properties and then Security tab> Advanced by clicking on the change button you can change the owner to your username. (if you don't know the name of your username run: "echo %USERNAME%" in command prompt.) Change>Advanced...>Find Now
Remove all Permission entries except the one you just added
click on Disable inheritance> Convert inherited permissions..... then remove all Permission entries except the one you just added.