📖 ~1 min read
Table of contents
Symptom & Impact
Users with valid keys are rejected, disrupting administrative access workflows.
Environment & Reproduction
Frequently happens after home directory permission drift or sshd hardening updates.
sshd -T | egrep 'pubkeyauthentication|authorizedkeysfile'
ls -ld ~ ~/.ssh ~/.ssh/authorized_keys
Root Cause Analysis
OpenSSH rejects keys when file permissions or allowed algorithms violate policy.
Quick Triage
Run a verbose SSH client test and inspect server auth logs immediately.
ssh -vv user@host
tail -n 100 /var/log/auth.log
Step-by-Step Diagnosis
Check ownership, mode bits, and algorithm compatibility across client/server.
stat -f '%Su %Sp %N' ~/.ssh ~/.ssh/authorized_keys
ssh -Q key

Solution – Primary Fix
Correct ownership/modes, refresh authorized keys, and reload sshd safely.
Still having issues? Our IT Consulting team can diagnose and resolve this for you. Get in touch for a free consultation.
chown -R user:user ~/.ssh
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
service sshd reload

Solution – Alternative Approaches
Use centralized SSH CA signing to reduce per-host authorized_keys complexity.
Verification & Acceptance Criteria
Key-based login succeeds without password fallback and logs show accepted key.
ssh -o PreferredAuthentications=publickey user@host 'id'
Rollback Plan
Restore previous sshd_config and authorized_keys backups if lockout risk appears.
Prevention & Hardening
Audit SSH file permissions routinely and enforce approved key algorithms.
Related Errors & Cross-Refs
Permission denied (publickey), Authentication refused: bad ownership or modes.
Related tutorial: View the step-by-step tutorial for freebsd-14.
View all freebsd-14 tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
OpenSSH hardening docs and FreeBSD sshd operational guidance.
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.