{"id":169,"date":"2025-07-16T09:04:32","date_gmt":"2025-07-16T09:04:32","guid":{"rendered":"https:\/\/hosting.international\/blog\/?p=169"},"modified":"2026-04-14T17:13:59","modified_gmt":"2026-04-14T17:13:59","slug":"how-to-connect-to-your-linux-server-via-ssh-a-beginners-guide","status":"publish","type":"post","link":"https:\/\/hosting.international\/blog\/how-to-connect-to-your-linux-server-via-ssh-a-beginners-guide\/","title":{"rendered":"How to Connect to Your Linux Server via SSH: A Beginner&#8217;s Guide"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"778\" height=\"434\" src=\"https:\/\/hosting.international\/blog\/wp-content\/uploads\/2025\/07\/image-5.png\" alt=\"\" class=\"wp-image-170\" srcset=\"https:\/\/hosting.international\/blog\/wp-content\/uploads\/2025\/07\/image-5.png 778w, https:\/\/hosting.international\/blog\/wp-content\/uploads\/2025\/07\/image-5-300x167.png 300w, https:\/\/hosting.international\/blog\/wp-content\/uploads\/2025\/07\/image-5-768x428.png 768w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/figure>\n\n\n\n<p>You&#8217;ve just launched your new Linux server\u2014a Virtual Private Server (VPS) or a dedicated machine. The next step is to take control. Since remote servers don&#8217;t have a physical monitor or keyboard, you&#8217;ll connect using a protocol called&nbsp;<strong>SSH (Secure Shell)<\/strong>.<\/p>\n\n\n\n<p>SSH is the industry standard for securely managing Linux servers. It provides an encrypted, command-line connection that allows you to execute commands, manage files, and configure every aspect of your server. For anyone working with servers, mastering SSH is the essential first step.<\/p>\n\n\n\n<p>This guide will walk you through everything you need to know to establish your first secure SSH connection.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Why SSH is Essential for Server Management<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Robust Encryption:<\/strong>&nbsp;Unlike older protocols like Telnet, SSH encrypts all data transmitted between your computer and the server. This prevents attackers from seeing your passwords, commands, or the data you transfer.<\/li>\n\n\n\n<li><strong>Full Remote Control:<\/strong>&nbsp;SSH gives you complete access to the server&#8217;s terminal (command-line interface). You can install software, edit configuration files, monitor system performance, and troubleshoot issues as if you were sitting right in front of the machine.<\/li>\n\n\n\n<li><strong>Command-Line Efficiency:<\/strong>&nbsp;The command line is a powerful and fast way to manage a server. With SSH, you can run complex scripts, automate repetitive tasks, and manage your system far more efficiently than with a graphical interface.<\/li>\n\n\n\n<li><strong>Universal Access:<\/strong>&nbsp;As long as you have an internet connection and your credentials, you can manage your server from anywhere in the world.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What You Need Before You Start<\/strong><\/h2>\n\n\n\n<p>To connect, you&#8217;ll need four key pieces of information:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Server IP Address or Hostname:<\/strong>&nbsp;The public address of your server (e.g.,&nbsp;203.0.113.55&nbsp;or&nbsp;server.yourdomain.com). You can find this in your hosting provider&#8217;s control panel.<\/li>\n\n\n\n<li><strong>SSH Port:<\/strong>&nbsp;The default port for SSH is&nbsp;<strong>22<\/strong>. For security, some providers change this to a different number (e.g.,&nbsp;2222). Always check if a custom port is specified.<\/li>\n\n\n\n<li><strong>Username:<\/strong>&nbsp;This is the account you will log in with.\n<ul class=\"wp-block-list\">\n<li><strong>Important Security Note:<\/strong>&nbsp;While many servers are provisioned with a&nbsp;root&nbsp;user, it is a major security risk to log in directly as&nbsp;root. The best practice is to immediately create a non-root user with&nbsp;sudo&nbsp;(administrator) privileges and use that for your daily work. If your provider has already created a non-root user for you, use that instead.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Password or SSH Key:<\/strong>&nbsp;The credential used to authenticate your login. While passwords work, they are vulnerable to brute-force attacks.&nbsp;<strong>SSH keys are the modern, far more secure standard<\/strong>, and you should switch to them as soon as possible.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Connecting to Your Server: Step-by-Step<\/strong><\/h3>\n\n\n\n<p>The connection method depends on your local computer&#8217;s operating system.<\/p>\n\n\n\n<p>Linux and macOS both include the OpenSSH client by default, making connection simple.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Open the Terminal:<\/strong>\n<ul class=\"wp-block-list\">\n<li>On macOS, go to&nbsp;Applications &gt; Utilities &gt; Terminal.<\/li>\n\n\n\n<li>On Linux, search for &#8220;Terminal&#8221; in your applications or press&nbsp;Ctrl+Alt+T&nbsp;on most distributions.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Use the&nbsp;ssh&nbsp;command:<\/strong>&nbsp;Type the following command, then press&nbsp;<strong>Enter<\/strong>: ssh username@server_ip_address<\/li>\n\n\n\n<li><strong>Accept the Host Key (First Time Only):<\/strong>&nbsp;The first time you connect, you will see a message like this: The authenticity of host &#8216;203.0.113.55 (203.0.113.55)&#8217; can&#8217;t be established. ED25519 key fingerprint is SHA256:AbCdEf1234&#8230; Are you sure you want to continue connecting (yes\/no\/[fingerprint])? This is a security feature to prevent man-in-the-middle attacks. It shows you the server&#8217;s unique fingerprint. Type&nbsp;yes&nbsp;and press&nbsp;<strong>Enter<\/strong>. The key will be saved to a&nbsp;known_hosts&nbsp;file on your computer.<\/li>\n\n\n\n<li><strong>Enter Your Password:<\/strong>&nbsp;You will be prompted for your password.&nbsp;<strong>Characters will not appear as you type.<\/strong>&nbsp;This is normal. Type your password carefully and press&nbsp;<strong>Enter<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p>If successful, you&#8217;ll see a welcome message and a new command prompt (e.g.,&nbsp;username@servername:~$), indicating you are logged into your server.<\/p>\n\n\n\n<p>Modern Windows (Windows 10 and 11) includes the same OpenSSH client as Linux and macOS. This is the recommended method.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Open PowerShell or Windows Terminal:<\/strong>&nbsp;Right-click the Start menu and select&nbsp;<strong>Terminal<\/strong>&nbsp;or&nbsp;<strong>PowerShell<\/strong>.<\/li>\n\n\n\n<li><strong>Use the&nbsp;ssh&nbsp;command:<\/strong>&nbsp;The command is identical to the one for Linux and macOS. ssh username@server_ip_address\n<ul class=\"wp-block-list\">\n<li>Use the&nbsp;-p&nbsp;flag for a custom port: ssh username@server_ip_address -p 2222<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Accept the Host Key and Enter Your Password:<\/strong>&nbsp;The process is the same. Type&nbsp;yes&nbsp;to accept the host key fingerprint, then enter your password when prompted.<\/li>\n<\/ol>\n\n\n\n<p>PuTTY is a popular free SSH client for Windows. If you prefer a graphical tool for managing sessions, it&#8217;s a good alternative.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Download and Install PuTTY:<\/strong>&nbsp;Get it from the official website:&nbsp;<strong><a href=\"https:\/\/www.google.com\/url?sa=E&amp;q=http%3A%2F%2Fwww.putty.org\" target=\"_blank\" rel=\"noreferrer noopener\">www.putty.org<\/a><\/strong>.<\/li>\n\n\n\n<li><strong>Configure the Connection:<\/strong>\n<ul class=\"wp-block-list\">\n<li>Launch PuTTY.<\/li>\n\n\n\n<li>In the&nbsp;<strong>Host Name (or IP address)<\/strong>&nbsp;field, enter your server&#8217;s IP.<\/li>\n\n\n\n<li>If you have a custom port, change it in the&nbsp;<strong>Port<\/strong>&nbsp;field.<\/li>\n\n\n\n<li>Ensure the&nbsp;<strong>Connection type<\/strong>&nbsp;is set to&nbsp;<strong>SSH<\/strong>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Save the Session (Optional but Recommended):<\/strong>&nbsp;In the&nbsp;<strong>Saved Sessions<\/strong>&nbsp;box, type a name for this connection (e.g., &#8220;My Web Server&#8221;) and click&nbsp;<strong>Save<\/strong>. Now you can just double-click the name to connect next time.<\/li>\n\n\n\n<li><strong>Open the Connection:<\/strong>&nbsp;Click the&nbsp;<strong>Open<\/strong>&nbsp;button at the bottom.<\/li>\n\n\n\n<li><strong>Accept the Security Alert:<\/strong>&nbsp;A window will pop up with the server&#8217;s host key. Click&nbsp;<strong>Accept<\/strong>&nbsp;to trust the server and store its key.<\/li>\n\n\n\n<li><strong>Enter Credentials:<\/strong>&nbsp;A terminal window will open. It will prompt for your&nbsp;login as:&nbsp;(username), press&nbsp;<strong>Enter<\/strong>, and then for your&nbsp;password, press&nbsp;<strong>Enter<\/strong>&nbsp;again.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Your First Few Commands on the Server<\/strong><\/h2>\n\n\n\n<p><strong>Once connected, try these basic commands:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>whoami&nbsp;&#8211; Shows the user you are currently logged in as.<\/li>\n\n\n\n<li>ls -la&nbsp;&#8211; Lists all files and directories in your current location, including hidden ones, with permissions and ownership.<\/li>\n\n\n\n<li>pwd&nbsp;&#8211; &#8220;Print Working Directory&#8221; shows your current location in the server&#8217;s file system (e.g.,&nbsp;\/home\/username).<\/li>\n\n\n\n<li>sudo apt update &amp;&amp; sudo apt upgrade&nbsp;&#8211;&nbsp;<strong>(For Debian\/Ubuntu)<\/strong>&nbsp;This is the most important first command. It updates your system&#8217;s package lists and upgrades all installed software to the latest versions.<\/li>\n\n\n\n<li>sudo dnf upgrade&nbsp;&#8211;&nbsp;<strong>(For CentOS\/Fedora\/RHEL)<\/strong>&nbsp;The equivalent command for Red Hat-based systems.<\/li>\n\n\n\n<li>exit&nbsp;&#8211; Safely closes the SSH connection.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Crucial Next Step: Set Up SSH Key Authentication<\/strong><\/h4>\n\n\n\n<p>Password authentication is convenient but not secure. SSH keys are the professional standard. They consist of a&nbsp;<strong>private key<\/strong>&nbsp;(kept secret on your computer) and a&nbsp;<strong>public key<\/strong>&nbsp;(placed on the server). The server will only grant access to someone who has the matching private key, making brute-force attacks nearly impossible.<\/p>\n\n\n\n<p><strong>Quick Steps to Set Up SSH Keys:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Generate Keys on Your Local Computer:<\/strong>&nbsp;Open your local terminal (or PowerShell) and run:ssh-keygen Press&nbsp;<strong>Enter<\/strong>&nbsp;to accept the default file location and options. You can optionally set a passphrase for extra security.<\/li>\n\n\n\n<li><strong>Copy the Public Key to Your Server:<\/strong>&nbsp;The easiest way is with the&nbsp;ssh-copy-id&nbsp;utility. <code>ssh-copy-id username@server_ip_address<\/code> Enter your password one last time. This command automatically copies your public key to the correct file on the server with the right permissions.<\/li>\n\n\n\n<li><strong>Log In Without a Password:<\/strong>&nbsp;Try logging in again (ssh username@server_ip_address). You should now be connected without being asked for a password!<\/li>\n\n\n\n<li><strong>Disable Password Authentication (Important!):<\/strong>&nbsp;Once you&#8217;ve confirmed your key works, you should disable password logins on your server for maximum security. This is done by editing the SSH configuration file (\/etc\/ssh\/sshd_config) and changing&nbsp;PasswordAuthentication yes&nbsp;to&nbsp;PasswordAuthentication no, then restarting the SSH service.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Troubleshooting Common Connection Issues<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Connection timed out<\/strong>: This usually means a firewall is blocking the connection. Check that your server&#8217;s firewall (like&nbsp;ufw&nbsp;or&nbsp;firewalld) allows traffic on your SSH port (e.g., 22). Also, ensure your local network or ISP isn&#8217;t blocking the port.<\/li>\n\n\n\n<li><strong>Connection refused<\/strong>: This means your computer reached the server, but the server actively rejected the connection. The most common causes are:\n<ul class=\"wp-block-list\">\n<li>The SSH service (sshd) is not running on the server.<\/li>\n\n\n\n<li>You are trying to connect to the wrong port.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Permission denied (publickey,password)<\/strong>: This is a very common authentication error. It means the server rejected all methods you tried. Check that:\n<ul class=\"wp-block-list\">\n<li>Your username and password are spelled correctly.<\/li>\n\n\n\n<li>If using an SSH key, ensure your public key is in the&nbsp;~\/.ssh\/authorized_keys&nbsp;file on the server and that file permissions are correct.<\/li>\n\n\n\n<li>The server might have password authentication disabled entirely.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h4>\n\n\n\n<p>You&#8217;ve now successfully connected to your Linux server via SSH and are ready to manage it. This is the foundational skill for all server administration. From here, you can start securing your server, installing software like a web server or database, and building your project. Welcome to the world of server management<\/p>\n\n\n\n<p>Read more:<\/p>\n\n\n\n<p><a href=\"https:\/\/hosting.international\/blog\/troubleshooting-a-slow-website-your-comprehensive-guide-to-diagnostics-and-fixes\/\" data-type=\"link\" data-id=\"https:\/\/hosting.international\/blog\/troubleshooting-a-slow-website-your-comprehensive-guide-to-diagnostics-and-fixes\/\">Troubleshooting a Slow Website: Your Comprehensive Guide to Diagnostics and Fixes<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You&#8217;ve just launched your new Linux server\u2014a Virtual Private Server (VPS) or a dedicated machine. The next step is to take control. Since remote servers don&#8217;t have a physical monitor or keyboard, you&#8217;ll connect using a protocol called&nbsp;SSH (Secure Shell). SSH is the industry standard for securely managing Linux servers. It provides an encrypted, command-line [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,32],"tags":[27],"class_list":["post-169","post","type-post","status-publish","format-standard","hentry","category-hosting-articles","category-knowledge-base","tag-how-to-connect-to-your-linux-server-via-ssh"],"_links":{"self":[{"href":"https:\/\/hosting.international\/blog\/wp-json\/wp\/v2\/posts\/169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hosting.international\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hosting.international\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hosting.international\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hosting.international\/blog\/wp-json\/wp\/v2\/comments?post=169"}],"version-history":[{"count":2,"href":"https:\/\/hosting.international\/blog\/wp-json\/wp\/v2\/posts\/169\/revisions"}],"predecessor-version":[{"id":303,"href":"https:\/\/hosting.international\/blog\/wp-json\/wp\/v2\/posts\/169\/revisions\/303"}],"wp:attachment":[{"href":"https:\/\/hosting.international\/blog\/wp-json\/wp\/v2\/media?parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hosting.international\/blog\/wp-json\/wp\/v2\/categories?post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hosting.international\/blog\/wp-json\/wp\/v2\/tags?post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}