SSH Key Permissions

One of the problems users have getting ssh public key authentication to work is that the permissions on the files or directories are incorrect (often too permissive). Below is a short list of commands to run in the user’s home directory in order to set the correct permissions.

All of these files/folders should be owned by the user, not root.

chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts
chmod 644 ~/.ssh/config
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub