ssh: connect to host example.com port 22: Connection timed out
SSH can’t reach the server within the timeout period.
Fix 1: Check if the server is reachable
ping example.com
telnet example.com 22
Fix 2: Check if SSH is running on the server
# On the server
sudo systemctl status sshd
sudo systemctl start sshd
Fix 3: Firewall blocking port 22
# Check firewall rules on server
sudo ufw status
sudo ufw allow 22
# Or iptables
sudo iptables -L -n | grep 22
Fix 4: Wrong port
# SSH might be on a non-standard port
ssh -p 2222 user@example.com
Fix 5: Cloud provider security group
If using AWS/GCP/Azure, check that the security group allows inbound TCP on port 22 from your IP.