debugModeratepending
SSH key authentication fails — permission and config issues
Viewed 0 times
SSH keyauthorized_keyspermission deniedssh -vvvchmod 600ssh-agent
terminallinuxmacos
Error Messages
Problem
SSH key-based authentication fails, falling back to password prompt. The key is correctly added to authorized_keys on the server but SSH still asks for a password.
Solution
(1) Check permissions — SSH is strict: ~/.ssh directory must be 700, authorized_keys must be 600, private key must be 600. (2) Check ownership: the .ssh dir and files must be owned by the user. (3) Verbose debug: ssh -vvv user@host to see which keys are tried and why they fail. (4) Check sshd_config: PubkeyAuthentication must be yes, AuthorizedKeysFile must point to the right file. (5) SELinux: restorecon -R ~/.ssh if SELinux is enforcing. (6) Home directory permissions: must not be group-writable (755 or stricter). (7) Check ssh-agent: ssh-add -l to see loaded keys, ssh-add ~/.ssh/id_ed25519 to add.
Why
SSH refuses key auth if any file in the chain has overly permissive permissions, because another user could have tampered with the keys or authorized_keys file.
Revisions (0)
No revisions yet.