SSH Key: “Permissions 0644 for 'id_rsa.pub' are too open.” on mac

I suggest you to do:

chmod 400 ~/.ssh/id_rsa

It works fine for me.


debug1: identity file /Users/tudouya/.ssh/vm/vm_id_rsa.pub type 1

It appears that you're trying to use the wrong key file. The file with the ".pub" extension contains the public portion of the key. The corresponding file without the ".pub" extension contains the private part of the key. When you run an ssh client to connect to a remote server, you have to provide the private key file to the ssh client.

You probably have a line in the your .ssh/config file (or /etc/ssh_config) which looks like this:

IdentityFile .../.ssh/vm/vm_id_rsa.pub

You need to remove the ".pub" extension from the filename:

IdentityFile .../.ssh/vm/vm_id_rsa

Key should be readable by the logged in user.

Try this:

chmod 400 ~/.ssh/Key file
chmod 400 ~/.ssh/vm_id_rsa.pub