{"id":75718,"date":"2023-01-18T14:46:31","date_gmt":"2023-01-18T14:46:31","guid":{"rendered":"\/tutorials\/?p=75718"},"modified":"2026-03-10T10:06:03","modified_gmt":"2026-03-10T10:06:03","slug":"ssh-connection-refused","status":"publish","type":"post","link":"\/my\/tutorials\/ssh-connection-refused","title":{"rendered":"SSH connection refused: what it is, causes, and 6 effective methods to fix it"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>When using an SSH (Secure Shell) protocol to access a remote server, you may encounter an SSH &ldquo;Connection refused&rdquo; error message. It is a common error indicating that your SSH server fails to accept connections.<\/p><p>In this tutorial, we will explain what the SSH &ldquo;Connection refused&rdquo; error is and its potential causes. Also, we will walk you through the six effective methods to resolve this SSH connection error.<\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/SSH-Cheat-Sheet-EN.pdf\" target=\"_blank\" rel=\"noopener\">Download ultimate SSH commands cheat sheet<\/a><\/p><p>\n\n\n\n<div class=\"protip\"><div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                   What is SSH connection refused?\n                <\/p>\n            <\/div>\n            <p class=\"protip__content\">SSH &ldquo;Connection refused&rdquo; is a network communication protocol failure that occurs when connecting to an SSH server. When the SSH connection fails, you won&rsquo;t be able to deploy secure encryption on your site and run more advanced tasks such as remote commands. Usually, this error is caused by a wrong SSH port, incorrect credentials, and a disabled SSH service.<\/p><\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-causes-the-ssh-connection-refused-error\">What causes the SSH connection refused error<\/h2><p>In this section, we will uncover the most common SSH &ldquo;Connection refused&rdquo; causes.<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Error code<\/strong>                            <\/td><td>Connection refused<\/td><\/tr><tr><td><strong>Error type<\/strong><\/td><td>Network communication protocol error<\/td><\/tr><tr><td><strong>Error causes<\/strong><\/td><td>Network problem<br>Incorrect SSH installation<br>Wrong credentials<br>Security system configuration<\/td><\/tr><\/tbody><\/table><\/figure><h3 class=\"wp-block-heading\" id=\"h-ssh-port-is-wrong\">SSH port is wrong<\/h3><p>The SSH port grants you access to a remote server. This is why it&rsquo;s important to ensure you&rsquo;re pointing at the right one when opening the SSH port. Otherwise, you will get the SSH &ldquo;Connection refused&rdquo; message when trying to perform a remote connection.<\/p><h3 class=\"wp-block-heading\" id=\"h-credentials-are-incorrect\">Credentials are incorrect<\/h3><p>Typing in the wrong credentials a few times will result in failed login attempts, causing the SSH &ldquo;Connection refused&rdquo; error. Make sure you&rsquo;re entering the correct username, password, hostname, and port to avoid an SSH connection failure.<\/p><h3 class=\"wp-block-heading\" id=\"h-ssh-client-is-not-installed\">SSH client is not installed<\/h3><p>Another common issue that causes the SSH &ldquo;Connection refused&rdquo; error is not having SSH client software installed on your localhost. An SSH client enables a secure connection to SSH servers. In short, you won&rsquo;t be able to initiate a connection request to an SSH server without the SSH client in the first place.<\/p><h3 class=\"wp-block-heading\" id=\"h-ssh-daemon-is-not-installed-on-the-server\">SSH Daemon is not installed on the server<\/h3><p>Besides the SSH client, you also need to install SSH Daemon to access a remote server from your local device. SSH Daemon will accept authenticated requests made through an SSH Client. An SSH &ldquo;Connection refused&rdquo; issue may occur when the SSH Daemon is not properly configured.<\/p><h3 class=\"wp-block-heading\" id=\"h-ssh-services-are-disabled\">SSH services are disabled<\/h3><p>Traffic surges and DDoS attacks are possible reasons for a disabled SSH service. When your SSH service is down, SSH Daemon won&rsquo;t be able to accept connections to a remote server. Therefore, you will face an SSH &ldquo;Connection refused&rdquo; message.<\/p><h3 class=\"wp-block-heading\" id=\"h-firewall-prevents-ssh-connection\">Firewall prevents SSH connection<\/h3><p>When a firewall protects your server from unauthorized incoming connections, it may also block SSH connections. You will need to apply specific firewall rules to enable the SSH connection requests and avoid the SSH &ldquo;Connection refused&rdquo; error.<\/p><h2 class=\"wp-block-heading\" id=\"h-6-ways-to-fix-the-ssh-connection-refused-error\">6 ways to fix the SSH connection refused error<\/h2><p>After identifying what has caused the SSH &ldquo;Connection refused&rdquo; error, it&rsquo;s time to fix it.<\/p><p>In this section, we will take a closer look at the six proven methods to do so.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-change-the-ssh-port-number\">1. Change the SSH port number<\/h3><p>An SSH connection runs on port 22 by default, but the port may be closed when left unused for a while due to security reasons. Therefore, ensure the SSH port is open before connecting to a remote server.<\/p><p>Use the following command to check for ports listening to requests:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo lsof -i -n -P | grep LISTEN<\/pre><p>However, the default open port 22 is more vulnerable to cyber attacks. We encourage you to use a different port to reduce security risks.<\/p><p>Here at Hostinger, we use the custom <strong>SSH Port 65002<\/strong>. Hence, you will see 65002 as the default port number when accessing SSH details on your hPanel.<\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Suggested Reading                <\/p>\n            <\/div>\n            <p class=\"protip__content\">For Hostinger&rsquo;s VPS hosting users, we suggest checking out our tutorial on <a href=\"\/my\/tutorials\/how-to-change-ssh-port-vps\/\">how to change the SSH port on VPS.<\/a><\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-2-double-check-the-credentials\">2. Double-check the credentials<\/h3><p>Make sure you&rsquo;re using the correct numbers and characters for the following information:<\/p><ul class=\"wp-block-list\">\n<li><strong>Host name <\/strong>&ndash;<strong> <\/strong>this is your domain name or your server&rsquo;s IP address.<\/li>\n\n\n\n<li><strong>Username<\/strong> &ndash;<strong> <\/strong>enter your FTP username.<\/li>\n\n\n\n<li><strong>Port <\/strong>&ndash; Hostinger users should use the custom port<strong> <\/strong>65002, while others can opt for the default port 22.<\/li>\n\n\n\n<li><strong>Password <\/strong>&ndash;<strong> <\/strong>type in your FTP account&rsquo;s password.<\/li>\n<\/ul><p>For Hostinger users, your SSH username and password will be the same as your FTP account. You can find these credentials on your hPanel.<\/p><p>To manage your password, navigate to the hPanel dashboard and access<strong> Files &rarr; FTP Accounts<\/strong>. You will see your FTP username details and an option to change your FTP password.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/07\/files-ftpaccounts.png\"><img decoding=\"async\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/07\/files-ftpaccounts.png\/w=1024,h=1024,fit=scale-down\" alt=\"FTP Accounts section in Hostinger's hPanel\"><\/a><\/figure><\/div><p>Note that if you&rsquo;re using other web hosts, you may have to access these details in a different way.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-make-sure-ssh-is-enabled\">3. Make sure SSH is enabled<\/h3><p>SSH Daemons won&rsquo;t be able to listen and accept requests if you don&rsquo;t enable your SSH server.<\/p><p>Hostinger users can manage SSH settings through the web control panel. Access <strong>Advanced &rarr; SSH Access <\/strong>on the sidebar of the hPanel dashboard. Check if your credentials are correct and click <strong>Enable<\/strong> to activate your SSH.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/07\/ssh-access.png\"><img decoding=\"async\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/07\/ssh-access.png\/w=1024,h=1024,fit=scale-down\" alt=\"SSH Access section in Hostinger's hPanel, showing the SSH status is active\"><\/a><\/figure><\/div><figure class=\"wp-block-image size-full\"><a href=\"\/my\/web-hosting\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/public\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/11\/Web-hosting_in-text-banner.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/11\/Web-hosting_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/11\/Web-hosting_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/11\/Web-hosting_in-text-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-4-make-sure-ssh-client-is-installed\">4. Make sure SSH client is installed<\/h3><p>Setting up an SSH Client on your device will let you perform remote commands over your server. Firstly, check if you&rsquo;ve installed one on your device by entering this on your terminal:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ssh<\/pre><p>Hostinger users can copy the <a href=\"\/my\/tutorials\/ssh\/basic-ssh-commands\/\">SSH command<\/a> from <strong>hPanel<\/strong>. Go to the <strong>Advanced<\/strong> section, click <strong>SSH Access, <\/strong>and you will see the command text under the <strong>Log in to SSH <\/strong>part. Then, click the <strong>Copy <\/strong>icon.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/07\/ssh-login.png\"><img decoding=\"async\" width=\"1413\" height=\"341\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/07\/ssh-login.png\/w=1024,h=1024,fit=scale-down\" alt=\"The copy icon in the Log in to SSH window on hPanel\" class=\"wp-image-113216\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/07\/ssh-login.png\/w=1413,fit=scale-down 1413w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/07\/ssh-login.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/07\/ssh-login.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/07\/ssh-login.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/45\/2024\/07\/ssh-login.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1413px) 100vw, 1413px\" \/><\/a><\/figure><\/div><p>Linux and macOS users can use the built-in terminal to <a href=\"https:\/\/support.hostinger.com\/en\/articles\/1583245-how-to-connect-to-your-account-via-ssh\" target=\"_blank\" rel=\"noopener\">connect accounts via SSH<\/a>. Meanwhile, Windows users should use an SSH client to establish a connection to their accounts, for instance, PuTTY.<\/p><p>On the same <strong>Log in to SSH<\/strong> window, click the PuTTY button, and you will see links to download the package files.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/my\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/01\/PuTTY-package-files-download-page.png\"><img decoding=\"async\" width=\"1240\" height=\"487\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/01\/PuTTY-package-files-download-page.png\/w=1024,h=1024,fit=scale-down\" alt=\"PuTTY package files download page\" class=\"wp-image-75727\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/01\/PuTTY-package-files-download-page.png 1240w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/01\/PuTTY-package-files-download-page-300x118.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/01\/PuTTY-package-files-download-page-1024x402.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/01\/PuTTY-package-files-download-page-150x59.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/01\/PuTTY-package-files-download-page-768x302.png 768w\" sizes=\"(max-width: 1240px) 100vw, 1240px\" \/><\/a><\/figure><\/div><p>Use the SSH details on your <strong>hPanel<\/strong>, such as the server IP address, username, port, and password, to connect to PuTTY.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/my\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/01\/PuTTY-configuration-window.png\"><img decoding=\"async\" width=\"671\" height=\"669\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/01\/PuTTY-configuration-window.png\/public\" alt=\"PuTTY configuration window\n\" class=\"wp-image-75728\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/01\/PuTTY-configuration-window.png 671w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/01\/PuTTY-configuration-window-300x300.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/01\/PuTTY-configuration-window-150x150.png 150w\" sizes=\"(max-width: 671px) 100vw, 671px\" \/><\/a><\/figure><\/div><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Suggested Reading                <\/p>\n            <\/div>\n            <p class=\"protip__content\">For more PuTTy configuration details, check our guide on <a href=\"\/my\/tutorials\/how-to-use-putty-ssh\/\">how to use the PuTTY SSH terminal.<\/a> <\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-5-ensure-ssh-daemon-is-installed-on-the-server\">5. Ensure SSH Daemon is installed on the server<\/h3><p>When a Daemon is unavailable, the SSH localhost may also block an incoming connection.<\/p><p>Most web hosting companies provide a pre-installed SSH Daemon on their server, but the SSH Daemon&rsquo;s status might be &ldquo;Down.&rdquo; If that is the case, contact your hosting provider about this issue.<\/p><p>Alternatively, you can restart your SSH service using the following command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">command sudo service ssh restart<\/pre><p>You can also check whether the service is working properly through PuTTY. To do so, use these commands:<\/p><ul class=\"wp-block-list\">\n<li>For Debian 12 and Ubuntu 24.04 users &ndash; <strong>sudo service ssh status<\/strong><\/li>\n\n\n\n<li>For CentOS 9 users &ndash; <strong>sudo service sshd status<\/strong><\/li>\n\n\n\n<li>For systemd users &ndash; <strong>sudo systemctl status sshd -l<\/strong><\/li>\n<\/ul><p>If you can&rsquo;t locate the SSH Daemon, you will need to set it up to start accepting connections.<\/p><p>Linux users can manually install an SSH tool like <a href=\"https:\/\/www.openssh.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">OpenSSH<\/a> and enter this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install openssh-server<\/pre><h3 class=\"wp-block-heading\" id=\"h-6-check-your-firewall-settings\">6. Check your firewall settings<\/h3><p>Manage your firewall settings to avoid it blocking SSH connections. Enable your iptables on the server and see if it shows a &ldquo;REJECT&rdquo; or &ldquo;DROP&rdquo; on your SSH port settings. Then, change it to &ldquo;ACCEPT.&rdquo;<\/p><p>You can use this command on your terminal to save the updated rules:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">service iptables save<\/pre><p>For Ubuntu or Debian users, allow your port on firewall settings using this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw allow port \/tcp<\/pre><p>After that, you need to reload the firewall setting by entering this on your command line interface:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw reload<\/pre><p>Check if the status has changed to &ldquo;ALLOW&rdquo; by typing this command:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw status<\/pre><p>If none of these work, reset the firewall first before applying rules to allow SSH connections. If you use <strong>iptables<\/strong>, run the following commands:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo iptables -F\nsudo iptables -X\nsudo iptables -t nat -F\nsudo iptables -t nat -X\nsudo iptables -t mangle -F\nsudo iptables -t mangle -X<\/pre><p>For <strong>ufw<\/strong>, use this command instead:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw reset<\/pre><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    &#128161; Pro Tip                <\/p>\n            <\/div>\n            <p class=\"protip__content\">Hostinger VPS customers can use <strong>Kodee<\/strong>, our AI-powered assistant, to reset firewall rules with ease. Simply type a prompt like \"Please reset the firewall rules on my VPS to the default state.\"<\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>SSH &ldquo;Connection refused&rdquo; is a common type of network communication protocol issue you may face when trying to connect to a server remotely. Luckily, you can easily identify its cause and fix the problem by enabling specific settings.<\/p><p>Let&rsquo;s recap the possible causes of SSH &ldquo;Connection refused&rdquo; and effective methods to solve them:<\/p><ul class=\"wp-block-list\">\n<li><strong>Wrong port <\/strong>&ndash;<strong> <\/strong>change to Port 22 or 65002 for Hostinger users to securely connect to your SSH server.<\/li>\n\n\n\n<li><strong>Wrong credentials <\/strong>&ndash;<strong> <\/strong>double-check for typos when writing your username, password, and IP address.<\/li>\n\n\n\n<li><strong>SSH client is set incorrectly<\/strong> &ndash;<strong> <\/strong>ensure you enable a command prompt on your terminal window or use PuTTY.<\/li>\n\n\n\n<li><strong>No SSH Daemon installed on the server side<\/strong> &ndash;<strong> <\/strong>make sure you have installed it to access the remote server.<\/li>\n\n\n\n<li><strong>Disabled SSH<\/strong> &ndash; check whether your SSH service is down, and don&rsquo;t forget to enable the SSH access setting on your hosting panel.<\/li>\n\n\n\n<li><strong>Firewall settings<\/strong> &ndash; allow SSH connections by applying specific settings on your firewall.<\/li>\n<\/ul><p>We hope this article helps you understand the SSH &ldquo;Connection refused&rdquo; error message and how to fix the SSH connection. If you have any further questions, leave a comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When using an SSH (Secure Shell) protocol to access a remote server, you may encounter an SSH &ldquo;Connection refused&rdquo; error message. It is a common error indicating that your SSH server fails to accept connections. In this tutorial, we will explain what the SSH &ldquo;Connection refused&rdquo; error is and its potential causes. Also, we will [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/my\/tutorials\/ssh-connection-refused\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":350,"featured_media":126957,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"SSH connection refused: 6 effective methods to fix it","rank_math_description":"Learn 6 effective ways to fix SSH connection refused: 1. Change SSH port 2. Check credentials 3. Enable SSH 4. Ensure SSL is installed + more.","rank_math_focus_keyword":"ssh connection refused","footnotes":""},"categories":[22639],"tags":[],"class_list":["post-75718","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/ssh-connection-refused","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/ssh-connection-refused","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/ssh-connection-refused","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/ssh-connection-refused","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/ssh-connection-refused","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/ssh-connection-refused","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/ssh-connection-refused","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/ssh-connection-refused","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/ssh-connection-refused","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/ssh-connection-refused","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/ssh-connection-refused","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/ssh-connection-refused","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/ssh-connection-refused","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/ssh-connection-refused","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/ssh-connection-refused","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/75718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/users\/350"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/comments?post=75718"}],"version-history":[{"count":17,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/75718\/revisions"}],"predecessor-version":[{"id":126952,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/75718\/revisions\/126952"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media\/126957"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media?parent=75718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/categories?post=75718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/tags?post=75718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}