{"id":4020,"date":"2026-04-15T17:46:38","date_gmt":"2026-04-15T21:46:38","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2017\/01\/06\/how-to-generate-ssh-keys\/"},"modified":"2026-04-16T10:28:42","modified_gmt":"2026-04-16T14:28:42","slug":"how-to-generate-ssh-keys","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/","title":{"rendered":"How to Generate SSH Keys and Set Up SSH Key Authentication"},"content":{"rendered":"\n<p><a aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/what-is-shell-access\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Secure Shell (SSH)<\/strong><\/a> access grants you <strong>command-line interface (CLI)<\/strong> access to your web server. SSH key authentication provides a secure, passwordless way to connect to your <a href=\"\/vps-hosting\">Linux VPS<\/a> or <a href=\"\/dedicated-servers\">dedicated server<\/a>. It replaces vulnerable password-based logins with a cryptographic key pair: a private key that stays on your local machine and a public key that resides on the server. This method eliminates brute-force attacks, enables secure automation, and is the recommended standard for all InMotion Hosting VPS and dedicated servers with root or sudo access.<\/p>\n\n\n\n<p>This comprehensive guide combines the complete process of <strong>generating SSH keys<\/strong> across Windows, Linux, and macOS with <strong>full server-side configuration<\/strong> for key-based authentication. It is written for users with a Linux VPS (Ubuntu, AlmaLinux, Debian, or similar) running OpenSSH.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How SSH Key Authentication Works<\/h2>\n\n\n\n<p>When you connect via SSH with key authentication, the server issues a cryptographic challenge. Your local machine uses the private key to respond, proving ownership without ever sending the key or a password over the network. If you protect the private key with a passphrase, that passphrase is only entered locally.<\/p>\n\n\n\n<p><strong>Key advantages over passwords:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>No password is transmitted or stored on the server.<\/li>\n\n\n\n<li>Immune to brute-force and dictionary attacks.<\/li>\n\n\n\n<li>Supports scripted\/automated connections without exposing credentials.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before starting:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A <a href=\"\/vps-hosting\">Linux VPS<\/a> or <a href=\"\/dedicated-servers\">Dedicated Server<\/a> with root or sudo access.<\/li>\n\n\n\n<li>Initial SSH access using password authentication (you will disable this at the end).<\/li>\n\n\n\n<li>Local machine running Linux, macOS, or Windows 10\/11 with OpenSSH client installed (native on macOS and modern Windows).<\/li>\n\n\n\n<li>Basic terminal familiarity.<\/li>\n<\/ul>\n\n\n\n<p class=\"alert alert-warning\"><strong>Note:<\/strong> Shared or Reseller Hosting uses a <a href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/shared-reseller-ssh\/#generate\">different SSH process<\/a>. This guide is for VPS\/dedicated servers with full root access.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Generate an SSH Key Pair on Your Local Machine<\/h2>\n\n\n\n<p>Generate the key pair <strong>on your local computer<\/strong>, never on the server. The current best practice is to use the <strong>Ed25519<\/strong> algorithm (faster and more secure than RSA). For maximum compatibility with older systems, you may use RSA 4096-bit keys.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Generating SSH Keys on Linux or macOS (Terminal)<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your <strong>Terminal<\/strong> application.<\/li>\n\n\n\n<li>Run the recommended command:<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ssh-keygen -t ed25519 -C \"your_identifier\"<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">ssh-keygen<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-t<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">ed25519<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-C<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;your_identifier&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>(Replace <code>your_identifier<\/code> with something descriptive like <code>work-laptop<\/code> or <code>admin@company.com<\/code>.)<\/p>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>When prompted for the file location, press <strong>Enter<\/strong> to accept the default (<code>~\/.ssh\/id_ed25519<\/code>).<\/li>\n\n\n\n<li>Enter a strong passphrase (recommended) and confirm it.<\/li>\n<\/ol>\n\n\n\n<p><strong>Alternative (RSA 4096-bit for legacy compatibility):<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ssh-keygen -t rsa -b 4096 -C \"your_identifier\"<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">ssh-keygen<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-t<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">rsa<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-b<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">4096<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-C<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;your_identifier&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>After generation, set correct permissions:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>chmod 700 ~\/.ssh\nchmod 600 ~\/.ssh\/*<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">chmod<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">700<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">chmod<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">600<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/<\/span><span style=\"color: #79B8FF\">*<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Generating SSH Keys on Windows with PowerShell (OpenSSH)<\/h3>\n\n\n\n<p>Windows 10\/11 includes OpenSSH natively.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open <strong>PowerShell<\/strong> as Administrator.<\/li>\n\n\n\n<li>Run:<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ssh-keygen -t ed25519 -C \"your_identifier\"<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">ssh<\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\">keygen <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\">t ed25519 <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\">C <\/span><span style=\"color: #9ECBFF\">&quot;your_identifier&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Accept the default file location by pressing <strong>Enter<\/strong>.<\/li>\n\n\n\n<li>Enter and confirm a strong passphrase.<\/li>\n\n\n\n<li>(Optional but recommended) Set correct permissions on the public key:<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>cd ~\/.ssh\nicacls id_ed25519.pub \/inheritance:r\nicacls id_ed25519.pub \/grant:r \"$env:USERNAME:(R)\"<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">cd ~<\/span><span style=\"color: #F97583\">\/<\/span><span style=\"color: #E1E4E8\">.ssh<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">icacls id_ed25519.pub <\/span><span style=\"color: #F97583\">\/<\/span><span style=\"color: #E1E4E8\">inheritance:r<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">icacls id_ed25519.pub <\/span><span style=\"color: #F97583\">\/<\/span><span style=\"color: #E1E4E8\">grant:r <\/span><span style=\"color: #9ECBFF\">&quot;<\/span><span style=\"color: #E1E4E8\">$<\/span><span style=\"color: #79B8FF\">env:<\/span><span style=\"color: #E1E4E8\">USERNAME<\/span><span style=\"color: #9ECBFF\">:(R)&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>Alternative (RSA 4096-bit):<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ssh-keygen -t rsa -b 4096 -C \"your_identifier\"<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">ssh<\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\">keygen <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\">t rsa <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\">b <\/span><span style=\"color: #79B8FF\">4096<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\">C <\/span><span style=\"color: #9ECBFF\">&quot;your_identifier&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Generating SSH Keys on Windows with PuTTY (Graphical Method)<\/h3>\n\n\n\n<p>For users who prefer a GUI:<\/p>\n\n\n\n<ol class=\"wp-block-list article_list\">\n<li>Download and open <strong>PuTTYgen<\/strong>.<\/li>\n\n\n\n<li>Select <strong>Ed25519<\/strong> (preferred) or <strong>RSA<\/strong> with <strong>4096<\/strong> bits.<\/li>\n\n\n\n<li>Click <strong>Generate<\/strong> and move your mouse in the blank area to create randomness.<\/li>\n\n\n\n<li>(Optional) Add a comment and a strong passphrase.<\/li>\n\n\n\n<li>Click <strong>Save private key<\/strong> (<code>.ppk<\/code> file) and <strong>Save public key<\/strong>.<\/li>\n\n\n\n<li>Copy the public key text from the top box for later use.<\/li>\n<\/ol>\n\n\n\n<p>Save both files in <code>C:\\Users\\YourUsername\\.ssh\\<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Copy the Public Key to Your Linux VPS<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Option A: Using ssh-copy-id (Linux\/macOS \u2013 Recommended)<\/h3>\n\n\n\n<p>From your local machine:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ssh-copy-id -i ~\/.ssh\/id_ed25519.pub username@your-server-ip<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">ssh-copy-id<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-i<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/id_ed25519.pub<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">username@your-server-ip<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>(Replace <code>username<\/code> with <code>root<\/code> or your sudo user, and <code>your-server-ip<\/code> with the VPS IP.)<\/p>\n\n\n\n<p>This command automatically creates <code>~\/.ssh\/authorized_keys<\/code>, sets permissions, and copies the key.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Option B: Manual Copy (Windows or When ssh-copy-id Is Unavailable)<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>On your local machine, display the public key:<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>cat ~\/.ssh\/id_ed25519.pub<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">cat<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/id_ed25519.pub<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>(Or open the <code>.pub<\/code> file and copy its entire contents.)<\/p>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li>SSH into your server with your current password:<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ssh username@your-server-ip<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">ssh<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">username@your-server-ip<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>On the server, create the directory and file:<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>mkdir -p ~\/.ssh\nnano ~\/.ssh\/authorized_keys<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">mkdir<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-p<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">nano<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/authorized_keys<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>Paste the public key on a single line and save\/exit.<\/li>\n\n\n\n<li>Set strict permissions (critical for security):<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>chmod 700 ~\/.ssh\nchmod 600 ~\/.ssh\/authorized_keys<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">chmod<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">700<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">chmod<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">600<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/authorized_keys<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Test Key Authentication<\/h2>\n\n\n\n<p>Open a <strong>new terminal<\/strong> window (do not close your existing session) and test:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ssh -i ~\/.ssh\/id_ed25519 username@your-server-ip<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">ssh<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-i<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/id_ed25519<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">username@your-server-ip<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>If successful, you will connect without a server password prompt (you may still be asked for your local key passphrase). Always test before proceeding to the next step.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Harden the SSH Configuration (Disable Password Authentication)<\/h2>\n\n\n\n<p>Once key authentication is confirmed:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>On the server, edit the SSH daemon config:<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>sudo nano \/etc\/ssh\/sshd_config<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">sudo<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">nano<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">\/etc\/ssh\/sshd_config<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li>Make the following changes (uncomment or add as needed):<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>PasswordAuthentication no\nPubkeyAuthentication yes\nAuthorizedKeysFile .ssh\/authorized_keys<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">PasswordAuthentication<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">no<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">PubkeyAuthentication<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">yes<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">AuthorizedKeysFile<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">.ssh\/authorized_keys<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>Optional but recommended for extra security:<\/strong><\/p>\n\n\n\n<p>Change the SSH port (reduces automated scanning):<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>Port 2222<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">Port<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">2222<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Prevent direct root login (use a sudo user instead):<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>PermitRootLogin prohibit-password<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">PermitRootLogin<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">prohibit-password<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Save and exit.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Restart the SSH Service and Apply Changes<\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>sudo systemctl restart sshd<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">sudo<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">systemctl<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">restart<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">sshd<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>(On some distributions the service is named <code>ssh<\/code> instead of <code>sshd<\/code>.)<\/p>\n\n\n\n<p><strong>If you changed the port:<\/strong><\/p>\n\n\n\n<p>Update your firewall:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>firewalld<\/strong> (AlmaLinux\/CentOS):<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>sudo firewall-cmd --permanent --add-port=2222\/tcp\nsudo firewall-cmd --reload<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">sudo<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">firewall-cmd<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">--permanent<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">--add-port=2222\/tcp<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">sudo<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">firewall-cmd<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">--reload<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>UFW<\/strong> (Ubuntu\/Debian):<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>sudo ufw allow 2222\/tcp\nsudo ufw delete allow 22\/tcp<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">sudo<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">ufw<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">allow<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">2222<\/span><span style=\"color: #9ECBFF\">\/tcp<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">sudo<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">ufw<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">delete<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">allow<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">22<\/span><span style=\"color: #9ECBFF\">\/tcp<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Test the new connection immediately in a new terminal using the updated port if changed:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ssh -i ~\/.ssh\/id_ed25519 -p 2222 username@your-server-ip<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">ssh<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-i<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/id_ed25519<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-p<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">2222<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">username@your-server-ip<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Manage Keys for Convenience (SSH Agent and Config File)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Add Keys to the SSH Agent<\/h3>\n\n\n\n<p>To avoid entering your passphrase every time:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>eval \"$(ssh-agent -s)\"\nssh-add ~\/.ssh\/id_ed25519<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #79B8FF\">eval<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;$(<\/span><span style=\"color: #B392F0\">ssh-agent<\/span><span style=\"color: #9ECBFF\"> <\/span><span style=\"color: #79B8FF\">-s<\/span><span style=\"color: #9ECBFF\">)&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">ssh-add<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/id_ed25519<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>On <strong>macOS<\/strong>, use:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ssh-add --apple-use-keychain ~\/.ssh\/id_ed25519<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">ssh-add<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">--apple-use-keychain<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/id_ed25519<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Use an SSH Config File for Multiple Servers<\/h3>\n\n\n\n<p>Create or edit <code>~\/.ssh\/config<\/code> on your local machine:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>nano ~\/.ssh\/config<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">nano<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/config<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Example:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>Host production-vps\n    HostName your-server-ip\n    User yourusername\n    IdentityFile ~\/.ssh\/id_ed25519\n    Port 2222\n\nHost staging-vps\n    HostName staging-ip\n    User deploy\n    IdentityFile ~\/.ssh\/id_ed25519_staging\n    Port 22<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">Host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">production-vps<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #B392F0\">HostName<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">your-server-ip<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #B392F0\">User<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">yourusername<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #B392F0\">IdentityFile<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/id_ed25519<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #B392F0\">Port<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">2222<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">Host<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">staging-vps<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #B392F0\">HostName<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">staging-ip<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #B392F0\">User<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">deploy<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #B392F0\">IdentityFile<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">~\/.ssh\/id_ed25519_staging<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #B392F0\">Port<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">22<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Now connect simply with:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>ssh production-vps<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">ssh<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">production-vps<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Final Notes and Best Practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Never share your private key.<\/li>\n\n\n\n<li>Always use a strong passphrase on production keys.<\/li>\n\n\n\n<li>Back up your <code>~\/.ssh<\/code> directory.<\/li>\n\n\n\n<li>InMotion Hosting VPS and Dedicated Server plans include full SSH key support from provisioning.<\/li>\n<\/ul>\n\n\n\n<p>You have now replaced password authentication with secure SSH key pairs. Your Linux server is significantly more secure against automated attacks while remaining convenient to access. For any InMotion-specific server management questions, refer to your control panel or support documentation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Secure Shell (SSH) access grants you command-line interface (CLI) access to your web server. SSH key authentication provides a secure, passwordless way to connect to your Linux VPS or dedicated server. It replaces vulnerable password-based logins with a cryptographic key pair: a private key that stays on your local machine and a public key that<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/\"> Read More ><\/a><\/p>\n","protected":false},"author":56983,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4307],"tags":[],"class_list":["post-4020","post","type-post","status-publish","format-standard","hentry","category-ssh"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Generate SSH Keys | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Learn how to generate SSH keys on WIndows and Unix in this article. You can then access and manage your server via command-line interface.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Generate SSH Keys | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Learn how to generate SSH keys on WIndows and Unix in this article. You can then access and manage your server via command-line interface.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-04-15T21:46:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-16T14:28:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2017\/01\/canva-how-to-generate-ssh-keys.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Carrie Smaha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@carriesmaha\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Carrie Smaha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/\"},\"author\":{\"name\":\"Carrie Smaha\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8\"},\"headline\":\"How to Generate SSH Keys and Set Up SSH Key Authentication\",\"datePublished\":\"2026-04-15T21:46:38+00:00\",\"dateModified\":\"2026-04-16T14:28:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/\"},\"wordCount\":873,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"SSH and Root Access\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/\",\"name\":\"How to Generate SSH Keys | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2026-04-15T21:46:38+00:00\",\"dateModified\":\"2026-04-16T14:28:42+00:00\",\"description\":\"Learn how to generate SSH keys on WIndows and Unix in this article. You can then access and manage your server via command-line interface.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Generate SSH Keys and Set Up SSH Key Authentication\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8\",\"name\":\"Carrie Smaha\",\"description\":\"Carrie Smaha is a Senior Marketing Operations leader with over 20 years of experience in digital strategy, web development, and IT project management. She specializes in go-to-market programs and SaaS solutions for WordPress and VPS Hosting, working closely with technical teams and customers to deliver high-performance, scalable platforms. At InMotion Hosting, she drives product marketing initiatives that blend strategic insight with technical depth.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/carriesmaha\/\",\"https:\/\/x.com\/carriesmaha\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/carries\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Generate SSH Keys | InMotion Hosting","description":"Learn how to generate SSH keys on WIndows and Unix in this article. You can then access and manage your server via command-line interface.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/","og_locale":"en_US","og_type":"article","og_title":"How to Generate SSH Keys | InMotion Hosting","og_description":"Learn how to generate SSH keys on WIndows and Unix in this article. You can then access and manage your server via command-line interface.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2026-04-15T21:46:38+00:00","article_modified_time":"2026-04-16T14:28:42+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2017\/01\/canva-how-to-generate-ssh-keys.png","type":"image\/png"}],"author":"Carrie Smaha","twitter_card":"summary_large_image","twitter_creator":"@carriesmaha","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Carrie Smaha","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/"},"author":{"name":"Carrie Smaha","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8"},"headline":"How to Generate SSH Keys and Set Up SSH Key Authentication","datePublished":"2026-04-15T21:46:38+00:00","dateModified":"2026-04-16T14:28:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/"},"wordCount":873,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["SSH and Root Access"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/","name":"How to Generate SSH Keys | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2026-04-15T21:46:38+00:00","dateModified":"2026-04-16T14:28:42+00:00","description":"Learn how to generate SSH keys on WIndows and Unix in this article. You can then access and manage your server via command-line interface.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/how-to-generate-ssh-keys\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Generate SSH Keys and Set Up SSH Key Authentication"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/595948dab2995d347a87076abdae19d8","name":"Carrie Smaha","description":"Carrie Smaha is a Senior Marketing Operations leader with over 20 years of experience in digital strategy, web development, and IT project management. She specializes in go-to-market programs and SaaS solutions for WordPress and VPS Hosting, working closely with technical teams and customers to deliver high-performance, scalable platforms. At InMotion Hosting, she drives product marketing initiatives that blend strategic insight with technical depth.","sameAs":["https:\/\/www.linkedin.com\/in\/carriesmaha\/","https:\/\/x.com\/carriesmaha"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/carries\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":4307,"name":"SSH and Root Access","slug":"ssh","link":"https:\/\/www.inmotionhosting.com\/support\/server\/ssh\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4020","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/56983"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4020"}],"version-history":[{"count":45,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4020\/revisions"}],"predecessor-version":[{"id":131938,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4020\/revisions\/131938"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}