📖 ~1 min read
Table of contents
Symptom & Impact
Key-based auth fails and operators fall back to passwords or lose remote access.
Environment & Reproduction
Typically occurs after user home migrations or backup restores.
ssh -vvv user@host
Root Cause Analysis
File mode, ownership, or SELinux label on ~/.ssh prevents sshd from accepting keys.
Quick Triage
Inspect sshd log entries and validate target user home attributes.
sudo journalctl -u sshd -n 100 --no-pager
Step-by-Step Diagnosis
Check permissions recursively and verify SELinux contexts on user key files.
ls -ld ~/.ssh && ls -l ~/.ssh/authorized_keys

Solution – Primary Fix
Correct modes/ownership and relabel user SSH files to expected contexts.
Still having issues? Our IT Consulting team can diagnose and resolve this for you. Get in touch for a free consultation.
chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys && chown -R user:user ~/.ssh && sudo restorecon -Rv /home/user/.ssh

Solution – Alternative Approaches
Use centralized identity with approved authorized keys command backend.
Verification & Acceptance Criteria
Public key authentication succeeds and password auth can remain disabled.
Rollback Plan
Restore original key files from backup and reapply prior sshd_config if needed.
Prevention & Hardening
Automate permission/context checks in provisioning and account management workflows.
Related Errors & Cross-Refs
Related: too open private key, denied by Match blocks, and account lockouts.
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
RHEL SSH hardening and SELinux user home context references.
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.