SSH Keys: Fixing the warning ‘UNPROTECTED PRIVATE KEY FILE!’

Maksym Bilan
1 min readFeb 2, 2015

--

During migration from one Mac to another, I copied my ssh keys and I’m faced with a problem. I’ve seen the next warning, when I did commands ‘fetch’, ‘push’, ‘pull’… for my repositories.

Full text of the warning you can see below:

To fix this, you’ll need to reset the permissions to default:

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

If you are getting another error:

Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/geek/.ssh/known_hosts).

This means that the permissions on that file are set incorrectly, and can be fixed with the next:

sudo chmod 644 ~/.ssh/known_hosts

And you should to adjust the directory permissions:

sudo chmod 755 ~/.ssh

That’s all. Now you can use your SSH keys without any errors or warnings.

--

--

Maksym Bilan
Maksym Bilan

Written by Maksym Bilan

Software Engineer at @MySwimPro |  swift/objc/c++ | 🇺🇦 | family 👨‍👩‍👧 | swimmer 🏊‍♂️ | optimist ⚡️ | superhero for my 👧

No responses yet