SSH File Permissions
conceptSSH refuses to use a private key if other users could read it. The logic: if the file is readable by others, it might already be compromised. SSH would rather fail than use a key it can't trust. The same applies to authorized_keys on the server side.
correct permissions (local machine)
# The .ssh directory itself
chmod 700 ~/.ssh
# Private keys—owner read/write only
chmod 600 ~/.ssh/id_*
# Public keys—owner read/write, others can read
chmod 644 ~/.ssh/id_*.pub
# Config file
chmod 600 ~/.ssh/config
# Known hosts
chmod 644 ~/.ssh/known_hosts
correct permissions (server side)
# Home directory—must not be writable by others
chmod 755 ~/
# Some servers require 700
# The .ssh directory
chmod 700 ~/.ssh
# Authorized keys file
chmod 600 ~/.ssh/authorized_keys
The home directory matters. This trips people up. Even if ~/.ssh and authorized_keys have correct permissions, SSH will reject the key if the home directory itself is group-writable or world-writable. This is a server-side sshd requirement, not a client-side one.