📖 ~1 min read
Table of contents
Symptom & Impact
SSH key login fails and administrators risk lockout.
Environment & Reproduction
Ubuntu 22.04 server with recent edits to ~/.ssh or /etc/ssh/sshd_config.
Root Cause Analysis
OpenSSH enforces strict ownership and permission checks on key files and home paths.
Quick Triage
Inspect auth log with journalctl -u ssh and run sshd -t for config validation.
Step-by-Step Diagnosis
Check permissions on home directory, .ssh directory, and authorized_keys file.

Solution – Primary Fix
Set chmod 700 ~/.ssh and chmod 600 ~/.ssh/authorized_keys with correct user ownership.
Still having issues? Our IT Consulting team can diagnose and resolve this for you. Get in touch for a free consultation.

Solution – Alternative Approaches
Temporarily allow password authentication from trusted subnet while repairing key setup.
Verification & Acceptance Criteria
SSH key auth succeeds and sshd -t returns clean configuration output.
Rollback Plan
Revert sshd_config changes and restart ssh service from console session.
Prevention & Hardening
Use configuration management to enforce known-good SSH permissions and options.
Related Errors & Cross-Refs
PAM misconfiguration and fail2ban bans can present similar login failures.
Related tutorial: View the step-by-step tutorial for Ubuntu 22.04 LTS.
View all Ubuntu 22.04 LTS tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Ubuntu 22.04 OpenSSH server hardening and troubleshooting documentation.
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.