SSHexit code > 0

ssh: Could not resolve hostname

$ssh: Could not resolve hostname my-server: Name or service not known

Analysis

The SSH client cannot translate the hostname you provided into an IP address.

Common Triggers

  • Typo in hostname.
  • DNS server failure.
  • Missing entry in ~/.ssh/config or /etc/hosts.

Debug Checks

  • $Ping the hostname: ping <hostname>.

Resolution

1
Correct the hostname typo.
2
Add the host to ~/.ssh/config or /etc/hosts.