How to fix Unprotected Private Key file on Mac OS X

I am trying to add my ssh private key file to a Mac in the terminal. When I run:

ssh-add -k / /path/file

this is the error I'm getting:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/Volumes/CREATIF IV/Creatif IV/Creatif IV_web/Personal/ssh-keys/anker/anker-prv_key.ppk' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

How to fix it?

2 Answers

As a general rule, private keys should only be manageable by the owner, optionally for the group (for example, if it has to be managed by apache2, it can be readable by the ssl-cert group) and have no permissions for the group and the others. So:

chmod 600 "/Volumes/CREATIF IV/Creatif IV/Creatif IV_web/Personal/ssh-keys/anker/anker-prv_key.ppk"

Should be enough in this case.

4

Normally you should assign the right permission for the file (chmod 600 file), but since it's on your external drive which could not support permissions, try adding it from the standard input to bypass the permission checks, for example:

cat "/Volumes/path/prv_key.ppk" | ssh-add -k/ -

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like