SSH Service Fails to Start on VOS Node (sshd Config Error / Exit Code 255)


Symptoms

The SSH service fails to start on a VOS node. The following errors are observed:

Root Cause

The sshd -t pre-flight check (run automatically by systemd before starting sshd) failed with exit code 255. This indicates a problem in the SSH daemon configuration — typically one of:

Diagnostic Steps

  1. Run the sshd config test directly to get the exact error:

    sudo sshd -t

    This will print the exact line and reason for the failure. Note it down.

  2. Check the systemd journal for additional context:

    sudo journalctl -xe -u ssh.service | tail -30
  3. Compare /etc/ssh/sshd_config with a known-good node at the same site or a similar healthy site. Look for:

    • Stray or misplaced # characters that comment out required directives
    • Typos in directive names or values
    • Any recently added or modified lines
  4. cat /etc/ssh/sshd_config
  5. Verify host key files exist and have correct permissions (must be 600, owned by root):

    ls -la /etc/ssh/ssh_host_*

    Expected output example:

    -rw------- 1 root root  227 Jan  1 00:00 /etc/ssh/ssh_host_ecdsa_key
    -rw-r--r-- 1 root root  162 Jan  1 00:00 /etc/ssh/ssh_host_ecdsa_key.pub
    -rw------- 1 root root  399 Jan  1 00:00 /etc/ssh/ssh_host_ed25519_key
    -rw-r--r-- 1 root root   82 Jan  1 00:00 /etc/ssh/ssh_host_ed25519_key.pub
    -rw------- 1 root root 1675 Jan  1 00:00 /etc/ssh/ssh_host_rsa_key
    -rw-r--r-- 1 root root  382 Jan  1 00:00 /etc/ssh/ssh_host_rsa_key.pub

    If any private key has permissions other than 600, fix with:

    sudo chmod 600 /etc/ssh/ssh_host_*_key
  6. Check for drop-in config files that may override or conflict:

    ls /etc/ssh/sshd_config.d/

Resolution

  1. Fix the issue identified in the sudo sshd -t output — most commonly a config syntax error. If a line was accidentally modified, restore it from a known-good node's /etc/ssh/sshd_config.

  2. Re-run the config test to confirm it passes cleanly (no output = success):

    sudo sshd -t
  3. Start the SSH service:

    sudo systemctl start ssh
    systemctl status ssh.service
  4. Confirm SSH is listening:

    ss -tlnp | grep sshd

Notes