{"id":151,"date":"2026-10-17T21:55:42","date_gmt":"2026-10-17T19:55:42","guid":{"rendered":"https:\/\/nodeguard.io\/blog\/?p=151"},"modified":"2026-10-18T20:19:47","modified_gmt":"2026-10-18T18:19:47","slug":"how-to-connect-to-a-linux-vps-using-ssh","status":"publish","type":"post","link":"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/","title":{"rendered":"How to Connect to a Linux VPS Using SSH: 7 Easy, Essential Steps"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">You just deployed a fresh server, and now you are staring at an IP address and a password. What next? Learning how to connect to a Linux VPS using SSH is the first real skill every server owner needs, and the good news is that it takes about five minutes once you know the steps. SSH is the door into your server. Everything else, from installing a web server to deploying an app, starts after you walk through it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide walks you through the whole process. You will gather your login details, connect from Windows, macOS or Linux, verify the server&#8217;s fingerprint, switch to safer SSH key authentication, save a shortcut so you never type the IP again, and lock the door behind you. Whether this is your first <a href=\"https:\/\/nodeguard.io\/cloud-vps\">Cloud VPS<\/a> or your tenth, the steps below work on any Linux distribution, including Ubuntu, Debian, AlmaLinux and Rocky Linux.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">In This Guide<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#What_Is_SSH_and_Why_Do_You_Use_It_to_Access_a_VPS\" >What Is SSH and Why Do You Use It to Access a VPS?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#What_You_Need_Before_You_Start\" >What You Need Before You Start<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#How_to_Connect_to_a_Linux_VPS_Using_SSH_in_7_Steps\" >How to Connect to a Linux VPS Using SSH in 7 Steps<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Step_1_Gather_Your_VPS_Login_Details\" >Step 1: Gather Your VPS Login Details<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Step_2_Open_an_SSH_Client_on_Your_Computer\" >Step 2: Open an SSH Client on Your Computer<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Step_3_Run_the_SSH_Command_and_Verify_the_Fingerprint\" >Step 3: Run the SSH Command and Verify the Fingerprint<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Step_4_Generate_an_SSH_Key_Pair\" >Step 4: Generate an SSH Key Pair<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Step_5_Copy_Your_Public_Key_to_the_VPS\" >Step 5: Copy Your Public Key to the VPS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Step_6_Save_a_Shortcut_in_Your_SSH_Config_File\" >Step 6: Save a Shortcut in Your SSH Config File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Step_7_Lock_Down_SSH_After_You_Connect\" >Step 7: Lock Down SSH After You Connect<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Common_SSH_Errors_and_How_to_Fix_Them\" >Common SSH Errors and How to Fix Them<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#%E2%80%9CConnection_refused%E2%80%9D\" >&#8220;Connection refused&#8221;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#%E2%80%9CConnection_timed_out%E2%80%9D\" >&#8220;Connection timed out&#8221;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#%E2%80%9CPermission_denied_publickey%E2%80%9D\" >&#8220;Permission denied (publickey)&#8221;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#%E2%80%9CPermission_denied_please_try_again%E2%80%9D\" >&#8220;Permission denied, please try again&#8221;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#%E2%80%9CWARNING_REMOTE_HOST_IDENTIFICATION_HAS_CHANGED%E2%80%9D\" >&#8220;WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED&#8221;<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Habits_That_Make_SSH_Safer_and_More_Pleasant\" >Habits That Make SSH Safer and More Pleasant<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Frequently_Asked_Questions\" >Frequently Asked Questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#What_port_does_SSH_use\" >What port does SSH use?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Can_I_SSH_into_a_VPS_from_Windows\" >Can I SSH into a VPS from Windows?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#Is_it_safe_to_log_in_as_root_over_SSH\" >Is it safe to log in as root over SSH?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#What_if_I_lose_my_SSH_private_key\" >What if I lose my SSH private key?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#What_is_the_difference_between_SSH_and_SFTP\" >What is the difference between SSH and SFTP?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/nodeguard.io\/blog\/how-to-connect-to-a-linux-vps-using-ssh\/#How_to_Connect_to_a_Linux_VPS_Using_SSH_Final_Thoughts\" >How to Connect to a Linux VPS Using SSH: Final Thoughts<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Is_SSH_and_Why_Do_You_Use_It_to_Access_a_VPS\"><\/span>What Is SSH and Why Do You Use It to Access a VPS?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">SSH stands for Secure Shell. It is a network protocol that lets you open a command-line session on a remote computer over an encrypted connection. When you SSH into a VPS, every keystroke you type and every line of output the server prints travels through an encrypted tunnel. Anyone watching the network in between sees only scrambled data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before SSH became standard, administrators used tools like Telnet, which sent passwords in plain text. That was fine on a trusted office network and a disaster on the open internet. SSH replaced it, and today it is the default way to manage almost every Linux server on the planet.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are three good reasons to use it:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Security.<\/strong> The connection is encrypted, and the server proves its identity to you with a cryptographic fingerprint.<\/li>\n\n\n\n<li><strong>Control.<\/strong> A VPS usually has no screen or desktop. SSH gives you a full command line with root or sudo power, so you can install software, edit files and restart services.<\/li>\n\n\n\n<li><strong>Automation.<\/strong> Deployment tools, backup scripts and Git all use SSH under the hood. Learn it once and you can use it everywhere.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If you are still deciding which type of hosting fits your project, our guide on <a href=\"https:\/\/nodeguard.io\/blog\/vps-vs-shared-hosting\">VPS vs shared hosting<\/a> explains why SSH access is one of the biggest advantages of a VPS in the first place.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_You_Need_Before_You_Start\"><\/span>What You Need Before You Start<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Gather these four things first and the rest is smooth:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Your VPS IP address.<\/strong> This is the public IPv4 address of your server, for example <code>203.0.113.10<\/code>. The IP is normally shown in your hosting client area or in the welcome email sent after you order.<\/li>\n\n\n\n<li><strong>A username.<\/strong> On most new VPS plans this is <code>root<\/code>. Some Ubuntu images use a regular user such as <code>ubuntu<\/code> with sudo rights instead.<\/li>\n\n\n\n<li><strong>A password or an SSH key.<\/strong> New servers typically start with a password you receive by email or set in the control panel. Later in this guide you will replace it with a key.<\/li>\n\n\n\n<li><strong>An SSH client.<\/strong> The good news is that you probably already have one. macOS, Linux and modern Windows all ship with OpenSSH built in.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">You also need the port number. SSH listens on port 22 by default, and unless your provider told you otherwise, that is the one to use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Connect_to_a_Linux_VPS_Using_SSH_in_7_Steps\"><\/span>How to Connect to a Linux VPS Using SSH in 7 Steps<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the full roadmap before we dive in:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Gather your VPS login details<\/li>\n\n\n\n<li>Open an SSH client on your computer<\/li>\n\n\n\n<li>Run the SSH command and verify the fingerprint<\/li>\n\n\n\n<li>Generate an SSH key pair<\/li>\n\n\n\n<li>Copy your public key to the VPS<\/li>\n\n\n\n<li>Save a shortcut in your SSH config file<\/li>\n\n\n\n<li>Lock down SSH after you connect<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-1-flow-1024x576.webp\" alt=\"how to connect to a linux vps using ssh\" class=\"wp-image-153\" srcset=\"https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-1-flow-1024x576.webp 1024w, https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-1-flow-300x169.webp 300w, https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-1-flow-768x432.webp 768w, https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-1-flow-900x506.webp 900w, https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-1-flow.webp 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_1_Gather_Your_VPS_Login_Details\"><\/span>Step 1: Gather Your VPS Login Details<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open your hosting dashboard and find the server&#8217;s details page. Write down the IP address, the username and the initial password. If you cannot find them, check the welcome email, because most providers send the credentials there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A quick tip: copy the password straight from the email or dashboard instead of typing it. Passwords generated by hosting panels are long and random, and a single mistyped character is the number one cause of the dreaded &#8220;Permission denied&#8221; message on a first login.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If your provider gives you a web-based console, keep that tab open as well. It works like a screen and keyboard plugged directly into the server, which makes it a handy safety net if you ever lock yourself out over SSH.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_2_Open_an_SSH_Client_on_Your_Computer\"><\/span>Step 2: Open an SSH Client on Your Computer<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The SSH client is the program on your own computer that makes the connection. Which one you open depends on your operating system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>On macOS or Linux<\/strong>, open the Terminal app. On macOS, press Command + Space, type &#8220;Terminal&#8221; and hit Enter. On most Linux desktops, press Ctrl + Alt + T. The <code>ssh<\/code> command is already installed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>On Windows 10 and 11<\/strong>, open PowerShell or Windows Terminal from the Start menu. Modern Windows includes the OpenSSH client, and you can confirm it by typing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -V\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If you see a version number, you are ready. If Windows says the command is not found, open Settings, go to Apps, then Optional Features, and add &#8220;OpenSSH Client&#8221;. Microsoft documents this process in its <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows-server\/administration\/openssh\/openssh_install_firstuse\" target=\"_blank\" rel=\"noopener\">OpenSSH installation guide<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Prefer a graphical tool?<\/strong> <a href=\"https:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/\" target=\"_blank\" rel=\"noopener\">PuTTY<\/a> is a long-standing free SSH client for Windows. You type the IP address into the &#8220;Host Name&#8221; box, keep the port at 22, make sure &#8220;SSH&#8221; is selected, and click Open. It works well, but the built-in PowerShell route is simpler, and everything in the rest of this guide uses the standard <code>ssh<\/code> command.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_3_Run_the_SSH_Command_and_Verify_the_Fingerprint\"><\/span>Step 3: Run the SSH Command and Verify the Fingerprint<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now for the main event. In your terminal, type the command below, replacing the username and IP address with your own:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh root@203.0.113.10\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The pattern is always <code>ssh username@server-address<\/code>. If your VPS uses a different port, add <code>-p<\/code> followed by the number:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -p 2222 root@203.0.113.10\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first time you connect to a server, your computer has never seen it before, so SSH asks you to confirm its identity. You will see a message similar to this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>The authenticity of host '203.0.113.10 (203.0.113.10)' can't be established.\nED25519 key fingerprint is SHA256:abcd1234exampleFingerprintxyz.\nAre you sure you want to continue connecting (yes\/no\/&#91;fingerprint])?\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is not a scary error. It is a security feature. The fingerprint is a short code that uniquely identifies your server. If you want to be extra careful, compare it with the fingerprint shown in your hosting panel or console. When it matches, type <code>yes<\/code> and press Enter. SSH then saves the fingerprint in a file called <code>known_hosts<\/code>, and future connections check against it automatically.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next, enter your password. Do not worry if nothing appears on screen while you type. Linux hides password characters completely, with no dots or stars, and that is normal. Press Enter, and if the password is right, you will land at a prompt like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@my-vps:~#\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Congratulations, you are inside your server. Try a harmless command to look around:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>uname -a\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It prints the kernel and system information of your VPS. If you just provisioned an Ubuntu machine and want to know what to do next, our guide on <a href=\"https:\/\/nodeguard.io\/blog\/how-to-set-up-an-ubuntu-vps\">how to set up an Ubuntu VPS<\/a> covers the first ten things worth doing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_4_Generate_an_SSH_Key_Pair\"><\/span>Step 4: Generate an SSH Key Pair<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Passwords work, but they are the weakest link. Bots scan the internet around the clock, trying common passwords against every SSH port they can find. SSH key authentication solves that problem, and it is also more convenient because you stop typing passwords altogether.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An SSH key is a pair of files:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A <strong>private key<\/strong> that stays on your computer and must never be shared.<\/li>\n\n\n\n<li>A <strong>public key<\/strong> that you place on the server. It is safe to share because it can only verify, never unlock.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">When you connect, the server challenges your computer to prove it holds the matching private key. The private key never crosses the network.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Generate a pair on your own computer, not on the server. Use the modern Ed25519 algorithm:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen -t ed25519 -C \"your-email@example.com\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Press Enter to accept the default file location. When asked for a passphrase, choose one. A passphrase encrypts the private key on disk, so even if someone steals your laptop or copies the file, they cannot use it. The command creates two files in your <code>.ssh<\/code> folder: <code>id_ed25519<\/code> (private) and <code>id_ed25519.pub<\/code> (public).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-2-keys-1024x576.webp\" alt=\"ssh key authentication\" class=\"wp-image-152\" srcset=\"https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-2-keys-1024x576.webp 1024w, https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-2-keys-300x169.webp 300w, https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-2-keys-768x432.webp 768w, https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-2-keys-900x506.webp 900w, https:\/\/nodeguard.io\/blog\/wp-content\/uploads\/2026\/10\/ssh-connect-internal-2-keys.webp 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_5_Copy_Your_Public_Key_to_the_VPS\"><\/span>Step 5: Copy Your Public Key to the VPS<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now place the public key on your server. On macOS and Linux, the easiest tool is <code>ssh-copy-id<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-copy-id root@203.0.113.10\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It asks for your password one last time, then appends your public key to the file <code>~\/.ssh\/authorized_keys<\/code> on the server. That file is the list of keys allowed to log in as that user.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On Windows PowerShell, <code>ssh-copy-id<\/code> is not always available, so use this one-liner instead:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>type $env:USERPROFILE\\.ssh\\id_ed25519.pub | ssh root@203.0.113.10 \"mkdir -p ~\/.ssh &amp;&amp; cat &gt;&gt; ~\/.ssh\/authorized_keys\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now test it by logging out with <code>exit<\/code> and connecting again:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh root@203.0.113.10\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This time you should be asked for your key passphrase, if you set one, instead of the server password. If it works, SSH key authentication is active. Do not close your working session yet, though, because there is one more important job to do before you call the setup complete.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_6_Save_a_Shortcut_in_Your_SSH_Config_File\"><\/span>Step 6: Save a Shortcut in Your SSH Config File<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Typing a username, an IP address and maybe a port number every time gets old fast. The SSH config file lets you give each server a short nickname.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open or create the file <code>~\/.ssh\/config<\/code> on your computer and add an entry like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Host myvps\n    HostName 203.0.113.10\n    User root\n    Port 22\n    IdentityFile ~\/.ssh\/id_ed25519\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file. From now on, connecting is as simple as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh myvps\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The same shortcut works for <code>scp<\/code> and <code>rsync<\/code>, so copying files becomes easier too. If you manage several servers, add one block per server. A clear naming scheme such as <code>web1<\/code>, <code>db1<\/code> and <code>staging<\/code> keeps things tidy as your infrastructure grows.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A few extra options are worth knowing. <code>ServerAliveInterval 60<\/code> sends a small signal every minute so idle connections do not drop. <code>ForwardAgent<\/code> lets you hop from one server to another with your local key, though you should only enable it for servers you trust.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_7_Lock_Down_SSH_After_You_Connect\"><\/span>Step 7: Lock Down SSH After You Connect<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once key login works, you can close the weakest doors. Everything in this step happens on the server, inside your SSH session. First, create a regular user with sudo rights instead of living as root:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>adduser deploy\nusermod -aG sudo deploy\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On AlmaLinux, Rocky Linux and other Red Hat family systems, the group is called <code>wheel<\/code> instead of <code>sudo<\/code>. Copy your key to the new user as well, using <code>ssh-copy-id deploy@203.0.113.10<\/code> from your computer, and confirm you can log in as that user.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then open the SSH server configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/ssh\/sshd_config\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Find or add these lines:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PermitRootLogin no\nPasswordAuthentication no\nPubkeyAuthentication yes\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file and restart the SSH service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart ssh\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On some distributions the service is named <code>sshd<\/code> instead of <code>ssh<\/code>. <strong>Important:<\/strong> before you close your current session, open a second terminal window and confirm you can still log in with your key. If you made a mistake, your first session is your lifeline to fix it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two optional upgrades help even more. Installing Fail2Ban bans IP addresses that fail too many logins, and a firewall such as UFW restricts which ports are reachable at all. If you change the SSH port, remember to allow the new port in the firewall before you restart SSH, or you will lock yourself out. For deeper reading on server-side options, the <a href=\"https:\/\/ubuntu.com\/server\/docs\/openssh-server\" target=\"_blank\" rel=\"noopener\">Ubuntu OpenSSH server documentation<\/a> is an excellent reference.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Common_SSH_Errors_and_How_to_Fix_Them\"><\/span>Common SSH Errors and How to Fix Them<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Even experienced admins hit these. Here is what each message really means.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%80%9CConnection_refused%E2%80%9D\"><\/span>&#8220;Connection refused&#8221;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The server is reachable, but nothing is listening on that port. The SSH service may be stopped, you may be using the wrong port, or a firewall is rejecting you. Use your provider&#8217;s web console to log in and run <code>sudo systemctl status ssh<\/code> to check the service.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%80%9CConnection_timed_out%E2%80%9D\"><\/span>&#8220;Connection timed out&#8221;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Your packets never reached the server, or no reply came back. Double-check the IP address, make sure the VPS is powered on, and confirm that a firewall, either on the server or at your provider, is not dropping port 22. A corporate or public Wi-Fi network that blocks outgoing SSH can cause this too, so try a different network.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%80%9CPermission_denied_publickey%E2%80%9D\"><\/span>&#8220;Permission denied (publickey)&#8221;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The server only accepts keys, and yours was not offered or not recognized. Check that you are using the right username, that your public key is in <code>~\/.ssh\/authorized_keys<\/code>, and that permissions are correct. The <code>.ssh<\/code> folder should be <code>700<\/code> and the <code>authorized_keys<\/code> file should be <code>600<\/code>. Running <code>ssh -v root@203.0.113.10<\/code> prints detailed debug output that shows exactly which keys were tried.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%80%9CPermission_denied_please_try_again%E2%80%9D\"><\/span>&#8220;Permission denied, please try again&#8221;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This usually means a wrong password or a wrong username. Remember that root login may be disabled on your server, so try your regular sudo user instead.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%80%9CWARNING_REMOTE_HOST_IDENTIFICATION_HAS_CHANGED%E2%80%9D\"><\/span>&#8220;WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED&#8221;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">SSH is warning you that the fingerprint of the server no longer matches the saved one. This is expected if you reinstalled the operating system on the VPS, because a new install creates new host keys. If you did not reinstall anything, stop and investigate before proceeding. When you are sure the change is legitimate, remove the old entry with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen -R 203.0.113.10\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Habits_That_Make_SSH_Safer_and_More_Pleasant\"><\/span>Habits That Make SSH Safer and More Pleasant<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once you can connect to your VPS reliably, a few habits will save you trouble later.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Use a passphrase on every private key.<\/strong> It costs you a few seconds per login, or nothing at all if you use <code>ssh-agent<\/code> to remember it for the session.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Keep a separate key per device.<\/strong> If a laptop is lost, you remove just that one line from <code>authorized_keys<\/code> and everything else keeps working.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Run long jobs inside tmux or screen.<\/strong> If your Wi-Fi drops while a software update is running, a plain SSH session can die and take the job with it. Tools like <code>tmux<\/code> keep the process alive on the server so you can reconnect and pick up where you left off.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Keep your software updated.<\/strong> Run <code>sudo apt update &amp;&amp; sudo apt upgrade<\/code> on Debian and Ubuntu, or <code>sudo dnf upgrade<\/code> on AlmaLinux and Rocky Linux, regularly. SSH is only as safe as the server it runs on.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Back up your private key.<\/strong> Losing it means you will need your provider&#8217;s console to regain access. Store an encrypted copy somewhere safe, but never in a public folder or a shared drive.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Know your options before choosing a server.<\/strong> If you are weighing a VPS against other setups, our comparison of <a href=\"https:\/\/nodeguard.io\/blog\/vps-vs-dedicated-server\">VPS vs dedicated server<\/a> shows how SSH and root access differ between them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Frequently_Asked_Questions\"><\/span>Frequently Asked Questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_port_does_SSH_use\"><\/span>What port does SSH use?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">SSH uses TCP port 22 by default. Some admins move it to a different port to cut down on automated scans, but that is a minor tweak and not a replacement for key authentication. If you change it, always use <code>-p<\/code> or the <code>Port<\/code> option in your config file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Can_I_SSH_into_a_VPS_from_Windows\"><\/span>Can I SSH into a VPS from Windows?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. Windows 10 and 11 include an OpenSSH client, so you can run <code>ssh user@ip<\/code> from PowerShell. You can also use PuTTY or the terminal that comes with tools such as VS Code. All of these let you connect to a Linux VPS using SSH with the same credentials.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Is_it_safe_to_log_in_as_root_over_SSH\"><\/span>Is it safe to log in as root over SSH?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It is common on new servers, but it is better practice to create a regular user with sudo rights and disable direct root login. Attackers always try the username <code>root<\/code> first, so removing it eliminates a large share of automated attacks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_if_I_lose_my_SSH_private_key\"><\/span>What if I lose my SSH private key?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You cannot recover it, but you are not locked out forever. Log in through your hosting provider&#8217;s web console or rescue mode, add a new public key to <code>authorized_keys<\/code>, and carry on. This is exactly why keeping the web console in mind from the start is useful.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_the_difference_between_SSH_and_SFTP\"><\/span>What is the difference between SSH and SFTP?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">SSH gives you a remote command line. SFTP is a file transfer protocol that runs over the same SSH connection, so the same login and keys work for both. Any SFTP client, such as FileZilla, can use your SSH key to upload and download files.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Connect_to_a_Linux_VPS_Using_SSH_Final_Thoughts\"><\/span>How to Connect to a Linux VPS Using SSH: Final Thoughts<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You now know how to connect to a Linux VPS using SSH from start to finish. You gathered your details, opened a client on Windows, macOS or Linux, accepted the host fingerprint, created an Ed25519 key pair, copied the public key to the server, saved a shortcut in your config file, and locked down password and root logins. That is the same routine professional sysadmins follow on every new server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The habit that matters most is the one in Step 7: never close your working session until you have tested a second login. Do that, and SSH becomes one of the most reliable tools you own.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ready to put it into practice? Spin up a server on a <a href=\"https:\/\/nodeguard.io\/cloud-vps\">NodeGuard Cloud VPS<\/a> and run through these seven steps yourself. If you ever get stuck, the NodeGuard team at <a href=\"https:\/\/nodeguard.io\/\">nodeguard.io<\/a> is happy to help. For the official reference on every option mentioned here, the <a href=\"https:\/\/www.openssh.com\/\" target=\"_blank\" rel=\"noopener\">OpenSSH project site<\/a> is the place to look.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"<p>You just deployed a fresh server, and now you are staring at an IP address and a password. What next? Learning how\u2026<\/p>\n","protected":false},"author":2,"featured_media":154,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[73,44,77,33,76,75,72,43,7,74],"class_list":["post-151","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-beginner-guide","tag-cloud-vps","tag-command-line","tag-linux-vps","tag-putty","tag-server-security","tag-ssh","tag-ssh-keys","tag-ubuntu","tag-vps-tutorial"],"_links":{"self":[{"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/posts\/151","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/comments?post=151"}],"version-history":[{"count":1,"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/posts\/151\/revisions"}],"predecessor-version":[{"id":155,"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/posts\/151\/revisions\/155"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/media\/154"}],"wp:attachment":[{"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/media?parent=151"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/categories?post=151"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nodeguard.io\/blog\/wp-json\/wp\/v2\/tags?post=151"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}