Pcornel
Linux · Linux Troubleshooting

SSH Failure

Cheat sheet · https://pcornel.dk/topic.php?topic=2920

Back to the Topic

Answer

SSH failures are problems connecting or authenticating with SSH: no connection, host key warnings, rejected keys or passwords, or immediate disconnects.

Remember

ssh -v on the client shows where it stops; the server's journal (journalctl -u ssh/sshd) shows why it refused. Common causes: firewall, sshd not running, wrong key or permissions on ~/.ssh, AllowUsers/PermitRootLogin, account locked.

First checks

  • journalctl -b -p err — errors this boot
  • systemctl --failed — failed units
  • df -h; df -i — space and inodes
  • ss -tulpn — listening sockets
  • dmesg -T | tail — recent kernel messages

Commands

journalctl -u sshd --since "-30 min" --no-pager
Bounded read-only observation/validation for recent sshd service, negotiation, authentication, authorization and sessio…
journalctl -u ssh -u sshd --since -10min

Verify in this order

TCP 22 reachable → key exchange → host key accepted → user authenticated → session

Where it usually breaks

First mismatch in persistent intent → provider/parser/generator → kernel/userspace runtime → dependency/security context → logs/counters → consumer-visible read-back; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2920

Confirmation

Confirm action

Continue?