LightYear
/Docs
DocsTroubleshootingCannot Connect via SSH

Cannot Connect via SSH

Diagnose and fix common SSH connection failures including timeout, refused connections, and authentication errors.

beginner
7 min read
LightYear Team
Updated April 24, 2026
sshtroubleshootingconnectivitynetworking
Ready to get started?

Common SSH Error Messages

ErrorLikely Cause
Connection timed outFirewall blocking port 22
Connection refusedSSH daemon not running
Permission denied (publickey)Wrong key or key not authorised
Host key verification failedServer IP changed
No route to hostServer offline or network issue

Step 1 — Verify the Server Is Running

Check the server status in the LightYear control panel. If it shows stopped or error, start or rebuild it.

Step 2 — Check Firewall Rules

Ensure port 22 (or your custom SSH port) is allowed from your IP:

  1. Go to Network → Firewall Groups → [Your Group].
  2. Verify there is an Accept rule for TCP port 22 from your IP.

Test with:

>_BASH
$nc -zv <SERVER_IP> 22
$# Connection to <SERVER_IP> 22 port [tcp/ssh] succeeded!

Step 3 — Verify Your SSH Key

>_BASH
$# Test with verbose output
$ssh -v -i ~/.ssh/your_key root@<SERVER_IP>

Look for:

debug1: Offering public key: /home/user/.ssh/your_key debug1: Server accepts key

If the key is rejected:

>_BASH
$# Check the key is in authorized_keys (via VNC console)
$cat /root/.ssh/authorized_keys

Step 4 — Use the VNC Console

If SSH is completely inaccessible, use the browser-based VNC console:

  1. Go to Servers → [Your Server] → Console.
  2. Log in with the root password (shown in server details).
  3. Check SSH daemon status:
>_BASH
$systemctl status sshd
$# If not running:
$systemctl start sshd

Step 5 — Clear the Known Hosts Entry

If the server was rebuilt and the IP reused:

>_BASH
$ssh-keygen -R <SERVER_IP>

Step 6 — Check SSH Logs

Via VNC console:

>_BASH
$journalctl -u sshd -n 50
$# or
$tail -50 /var/log/auth.log

Checklist

  • Server status is active
  • Firewall allows TCP port 22 from your IP
  • Correct SSH key selected
  • SSH daemon is running
  • Known hosts entry cleared after rebuild

Was this article helpful?

Your cookie choices for this website

This site uses cookies and related technologies, as described in our privacy policy, for purposes that may include site operation, analytics, and enhanced user experience. You may choose to consent to our use of these technologies, or manage your own preferences. Cookie policy