SSH: “Permissions 0644 for ‘the_key.pub’ are too open.”

file-permissionspermissionssshssh-keys

Why is 0644 i.e. -rw-r--r-- too open for a SSH key? Also I could not find any false permissions on the .ssh directory (0700) or the home directory (0731).

Btw I'm getting this error when testing the paraphrase of a key via ssh-keygen -y -f my_key.pub

Best regards

Best Answer

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.

Related Question