Troubleshooting
Can’t Connect After Changes
sudo systemctl status sshdsudo ufw status # or: firewall-cmd --list-allsudo sshd -tsudo journalctl -u sshd -n 50Permission Denied (publickey)
ls -la ~/.ssh# .ssh: 700 | authorized_keys: 600 | private keys: 600
chmod 700 ~/.sshchmod 600 ~/.ssh/authorized_keysToo Many Authentication Failures
Multiple keys in your SSH agent will trigger this:
ssh-add -Dssh-add ~/.ssh/id_prod_server
# Or force a specific keyssh -o IdentitiesOnly=yes -i ~/.ssh/id_prod_server user@server2FA Code Not Working
timedatectl statussudo systemctl restart chrony # or ntpdMonthly Security Audits
# Review authorized_keyscat ~/.ssh/authorized_keys
# Check for weak host keysfor key in /etc/ssh/ssh_host_*_key.pub; do ssh-keygen -lf $key; done
# Anomalies in auth logssudo grep -i "POSSIBLE BREAK-IN" /var/log/auth.log
# Users with empty passwordssudo awk -F: '($2 == "") {print $1}' /etc/shadowKey Rotation
I rotate SSH keys annually: generate new pair → deploy to all servers → test → remove old public key → update documentation.
Enterprise Documentation
Track: SSH configuration changes, authorized users and their keys, justification for any non-standard settings, incident response procedures, key rotation schedule.