ssh key file unprotected private key file error ev

2019-06-02 21:26发布

问题:

I have a weird problem where every time after I reboot my Mac I get the following error while trying to deploy using capistrano

Permissions 0644 for '/Users/guy/.ssh/id_rsa.pub' are too open

I don't remember how I fixed this last time. I just remember it was annoying and also happened a reboot to the computer.

my permission for the id_rsa file are 600 and for the id_rsa.pub are 644

if I run chmod 600 id_rsa

then it will ask for a password while deploying with capistrano. a password which I don't know...

any help would be appreciated. thanks

回答1:

You need to make sure that all the parent folders of your ssh keys are not writable for group or other.

For instance: 755 or stricter (not 775 anywhere)

That is for:

  • /Users
  • /Users/guy
  • /Users/guy/.ssh

The question "Password dialog appears when SSH private key permissions are set to 0600" includes a lot of good advices, including one that the OP followed:

When I had an id_rsa but not a corresponding id_rsa.pub, Mac OS X kept popping up the dialog and remember password in my keychain did nothing.

cd ~/.ssh
ssh-keygen -y -f id_rsa > id_rsa.pub

generated the appropriate public key file for me.

So re-generating can help.



回答2:

ended up just creating a new ssh key with a passphrase, because no other solution worked

https://help.github.com/articles/generating-ssh-keys