SSH: "Permissions 0644 for 'my_key.pub' are too open."

The only command you need to run is chmod 600 ~/.ssh/id_rsa. That's it.

This changes the permissions on the file so that the owner (you) can read and write it, which will remove the error message you receive.


0644 in not supposed to be too open for a public key, but is too open for your private key.

Your private key should have permission 0600 while your public key have permission 0644.

By the way, you should also take care of the permission on .ssh folder. It should has the permission 0700, so that only you, the owner, has control over the folder.

As to your home directory, write permission is not supposed to be granted to group and others.

Run chmod go-w /home/username should fix that.


You may be running ssh-keygen on the wrong file. ssh-keygen -y operates on a private key file. ".pub" files normally contain the public key. You probably have a file there named my_key, without any extension, and it ought to be mode 0600. That is the file which should contain the private key.

To directly answer your question, SSH keys are normally used to permit connecting to remote servers without a password. Possession of the private key would permit someone to log into your account on any system which accepts the key. ssh-keygen and the other ssh utilities require private key files to have restricted permissions because the files are sensitive and need to remain secure.