π ~1 min read
Table of contents
Symptom & Impact
SSH key login fails, forcing password auth or locking automation out of the host.
Environment & Reproduction
Often appears after home directory migration or hardening edits to sshd_config.
ssh -vvv user@host ; sudo systemctl status sshd
Root Cause Analysis
Wrong file mode, ownership, or SELinux context causes sshd to ignore authorized_keys.
Quick Triage
Inspect sshd logs and verify key auth settings.
sudo journalctl -u sshd -n 100 ; sudo grep -E 'PubkeyAuthentication|AuthorizedKeysFile' /etc/ssh/sshd_config
Step-by-Step Diagnosis
Validate user home perms, authorized_keys ownership, and SELinux labels.
namei -l /home/user/.ssh/authorized_keys ; ls -laZ /home/user/.ssh ; getenforce

Solution β Primary Fix
Repair permissions and contexts, then reload sshd safely.
Still having issues? Our IT Consulting team can diagnose and resolve this for you. Get in touch for a free consultation.
chmod 700 /home/user/.ssh ; chmod 600 /home/user/.ssh/authorized_keys ; chown -R user:user /home/user/.ssh ; restorecon -Rv /home/user/.ssh ; sudo systemctl reload sshd

Solution β Alternative Approaches
Temporarily enable PasswordAuthentication only during controlled recovery window.
Verification & Acceptance Criteria
Key-based login succeeds and password fallback is disabled per policy.
ssh -o PreferredAuthentications=publickey user@host true ; sudo sshd -t
Rollback Plan
Restore previous sshd_config and authorized_keys backup if regressions occur.
sudo cp /etc/ssh/sshd_config.bak /etc/ssh/sshd_config ; sudo systemctl restart sshd
Prevention & Hardening
Use config management to enforce ssh file perms and regularly run sshd config tests.
Related Errors & Cross-Refs
May coincide with SELinux AVC denials and SSSD home directory mapping issues.
Related tutorial: View the step-by-step tutorial for rhel-10.
View all rhel-10 tutorials on the Tutorials Hub β
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
OpenSSH hardening guides and RHEL security baseline recommendations.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β we respond within one business day.