{"id":1981,"date":"2026-01-28T04:11:22","date_gmt":"2026-01-28T04:11:22","guid":{"rendered":"https:\/\/veerhost.com\/docs\/vps\/fix-ssh-connection-refused-timeout-on-your-vps\/"},"modified":"2026-03-31T17:54:49","modified_gmt":"2026-03-31T17:54:49","slug":"fix-ssh-connection-refused-timeout-on-your-vps","status":"publish","type":"docs","link":"https:\/\/veerhost.com\/de\/docs\/vps\/fix-ssh-connection-refused-timeout-on-your-vps\/","title":{"rendered":"Fix: SSH Connection Refused \/ Timeout on Your VPS"},"content":{"rendered":"<p class=\"wp-block-paragraph\">If you&#8217;re getting <code>Connection refused<\/code>, <code>Connection timed out<\/code>, or <code>ssh: connect to host port 22: Connection refused<\/code> when trying to SSH into your VeerHost VPS, this guide covers every likely cause and how to fix it step by step.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Cause 1: Wrong IP Address or Port<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Double-check your SSH command. The correct format is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh root@YOUR_VPS_IP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If your VPS uses a custom SSH port (e.g., 2299), you must specify it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -p 2299 root@YOUR_VPS_IP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify the VPS IP is correct by logging into your VeerHost client area and confirming the IP shown on your VPS dashboard.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Cause 2: SSH Service is Not Running<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If the SSH daemon crashed or was stopped, you won&#8217;t be able to connect. Access your server via the <strong>VeerHost VPS Console<\/strong> (available in your client area \u2014 no SSH needed), then run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status sshd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If it&#8217;s inactive or failed, start it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start sshd\nsystemctl enable sshd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On some systems the service is called <code>ssh<\/code> instead of <code>sshd<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start ssh\nsystemctl enable ssh<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Cause 3: Firewall Blocking Port 22<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If UFW or iptables is blocking port 22, SSH connections will be refused. Via the VPS console, check UFW status:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ufw status<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If UFW is active and port 22 is not listed, allow it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ufw allow 22\/tcp\nufw reload<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To check iptables directly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>iptables -L INPUT -n -v | grep 22<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Cause 4: Incorrect SSH Config (sshd_config Error)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A typo in <code>\/etc\/ssh\/sshd_config<\/code> can break SSH completely. Via the VPS console:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sshd -t<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This tests the config file and shows any errors. Fix the reported lines, then restart SSH:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart sshd<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Cause 5: SSH Package Not Installed<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On some minimal OS images, the SSH server may not be installed. Via the VPS console:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update\napt install -y openssh-server\nsystemctl enable ssh\nsystemctl start ssh<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Cause 6: Too Many Authentication Failures<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you have multiple SSH keys in your <code>~\/.ssh\/<\/code> directory, SSH may try them all and hit the server&#8217;s <code>MaxAuthTries<\/code> limit. Force a specific key:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -i ~\/.ssh\/id_ed25519 root@YOUR_VPS_IP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Or temporarily disable the SSH agent:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -o IdentitiesOnly=yes -i ~\/.ssh\/id_ed25519 root@YOUR_VPS_IP<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Cause 7: VPS is Overloaded or Crashed<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If the server is completely unresponsive, it may be locked up due to high load or OOM (out of memory). Log into your <strong>VeerHost client area<\/strong> and use the VPS Console to check. If the server is frozen, use the control panel to perform a <strong>hard reboot<\/strong>. After rebooting:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Check what's eating memory\nfree -h\n\n# Check CPU and process usage\ntop\n\n# Check disk space (a full disk also kills SSH)\ndf -h<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Cause 8: Banned by Fail2Ban<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If fail2ban is installed and you entered the wrong password too many times, your IP may be banned. Via the VPS console:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Check if your IP is banned\nfail2ban-client status sshd\n\n# Unban your IP (replace 1.2.3.4 with your actual IP)\nfail2ban-client set sshd unbanip 1.2.3.4<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Still Can&#8217;t Connect?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use the <strong>Emergency Console<\/strong> in your VeerHost client area to access the server without SSH. From there you can diagnose any issue. If you&#8217;re still stuck, <a href=\"https:\/\/veerhost.com\/de\/support\/\">open a support ticket<\/a> and include your VPS IP and the exact error message.<\/p>","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re getting Connection refused, Connection timed out, or ssh: connect to host port 22: Connection refused when trying to SSH into [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1967,"menu_order":5,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-1981","docs","type-docs","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/veerhost.com\/de\/wp-json\/wp\/v2\/docs\/1981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/veerhost.com\/de\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/veerhost.com\/de\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/veerhost.com\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/veerhost.com\/de\/wp-json\/wp\/v2\/comments?post=1981"}],"version-history":[{"count":3,"href":"https:\/\/veerhost.com\/de\/wp-json\/wp\/v2\/docs\/1981\/revisions"}],"predecessor-version":[{"id":2284,"href":"https:\/\/veerhost.com\/de\/wp-json\/wp\/v2\/docs\/1981\/revisions\/2284"}],"up":[{"embeddable":true,"href":"https:\/\/veerhost.com\/de\/wp-json\/wp\/v2\/docs\/1967"}],"wp:attachment":[{"href":"https:\/\/veerhost.com\/de\/wp-json\/wp\/v2\/media?parent=1981"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/veerhost.com\/de\/wp-json\/wp\/v2\/doc_tag?post=1981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}