Interview Prep/Linux/SSH, sudo and authentication

`ssh` reports `ssh: connect to host server01 port 22: Connection refused` after you edited `sshd_config`.

BeginnerTroubleshootingSSH, sudo and authentication
Answer

Likely causes → sshd failed to restart because of a config syntax error, or it now listens on a different port.

Diagnose → (via console)

sudo sshd -t
systemctl status sshd
sudo ss -tlnp | grep sshd

Fix → Correct the reported line, sshd -t, then systemctl restart sshd.

Prevent → Always run sshd -t before restart and keep an open session while testing.

All Linux questions Roadmap: Linux

More on SSH, sudo and authentication