<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Keys and More]]></title><description><![CDATA[Keys and More]]></description><link>https://pairoshousekeys.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 11:00:08 GMT</lastBuildDate><atom:link href="https://pairoshousekeys.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[🔐 SSH & Key Pairs Explained End-to-End (AWS EC2 | From Basics to Advanced)]]></title><description><![CDATA[SSH key pairs are backbone for cloud, linux and DevOps security practices. In this article, we will understand what SSH is and how it works and how an EC2 instance can be accessible even without a key pair.
What is SSH?
First things first, what is S....]]></description><link>https://pairoshousekeys.hashnode.dev/ssh-and-key-pairs-explained-end-to-end-aws-ec2-from-basics-to-advanced</link><guid isPermaLink="true">https://pairoshousekeys.hashnode.dev/ssh-and-key-pairs-explained-end-to-end-aws-ec2-from-basics-to-advanced</guid><category><![CDATA[#DevOps #AWS #SSH #Linux #CloudComputing #EC2 #Security]]></category><dc:creator><![CDATA[vihari reddy]]></dc:creator><pubDate>Tue, 06 Jan 2026 18:17:14 GMT</pubDate><content:encoded><![CDATA[<p><code>SSH key pairs are backbone for cloud, linux and DevOps security practices. In this article, we will understand what SSH is and how it works and how an EC2 instance can be accessible even without a key pair.</code></p>
<p>What is SSH?</p>
<p>First things first, what is S.S.H?</p>
<p>ssh (Secure shell) is a secure protocol used to connect to remote Linux servrs.</p>
<ul>
<li><p>Encrypts communication</p>
</li>
<li><p>Replaces insecure password login</p>
</li>
<li><p>Industry standard for server access.</p>
</li>
</ul>
<p>In Simple words:</p>
<p>| SSH lets you safely login into another computer over the network.</p>
<h1 id="heading-what-is-an-ssh-key-pair"><strong>🔐 What is an SSH Key Pair?</strong></h1>
<p>An SSH Key pair has two keys:</p>
<hr />
<p>Key Purpose Share</p>
<p>Private Key Proves identity ❌</p>
<p>Public Key Verifies identity ✅</p>
<h3 id="heading-the-default-location-of-ssh-files-is-ssh">The default location of SSH files is <code>~/.ssh</code></h3>
<p>some of the important files you can find</p>
<ol>
<li><p><code>id_ed25519</code> → private key</p>
</li>
<li><p><code>id_</code><a target="_blank" href="http://ed25519.pub"><code>ed25519.pub</code></a> → public key</p>
</li>
<li><p><code>authorized_keys</code> → allowed public keys on server</p>
</li>
</ol>
<p>To generate the SSH Key pair of your machine</p>
<p>ssh-keygen -t ed25519</p>
<p>🏢 How SSH Authentication Works</p>
<p>participant <mark>Client</mark> participant <mark> Server</mark></p>
<p>Client-&gt;&gt;Server: SSH request</p>
<p>Server-&gt;&gt;Client: Challenge</p>
<p>Client-&gt;&gt;Server: Signed using private key</p>
<p>Server-&gt;&gt;Server: Verify using public key</p>
<p>Server--&gt;&gt;Client: Access granted</p>
<p>⚠️ <mark>Private key should neven leave your machine</mark>.</p>
<p>SSH in AWS EC2 (Normal Flow)</p>
<p>When launching EC2:</p>
<p>—&gt; AWS asks for key pair</p>
<p>—&gt; Public key is stored in:</p>
<p>~/.ssh/authroized_keys</p>
<p>Connect to SSH Using:</p>
<p>ssh -i key.pem ubuntu@«ec2-IP»</p>
<p>Different scenarios to connect</p>
<p>Scenarion 1: Connect EC2(A) —&gt; EC2 (B) [No Password]</p>
<p>on EC2-A</p>
<p>ssh-keygen -t ed25519 (take the public key on ec2(A))</p>
<p>cat ~/.ssh/id_ed25519.pub</p>
<p>on EC2-B</p>
<p>paste the public key of ec2(A) and keep it in Authorised keys of B</p>
<p>~/.ssh/authorized_keys</p>
<p>Now login to EC2(B) using EC2(A)</p>
<p>Quick and Faster method ⚡</p>
<h2 id="heading-ssh-copy-id-ubuntuec2-ip"><strong><em><mark>ssh-copy-id ubuntu@«EC2-IP»</mark></em></strong></h2>
<p>This above command will handle on permissions and keys.</p>
<p>Scenario 2: EC2 Launched Without Key Pair 😨</p>
<h3 id="heading-first-method-reuse-another-instance-key">First Method: Reuse Another instance key</h3>
<p>—&gt; Copy the public key from EC2-A</p>
<p>—&gt; Add to EC2-B authorized_keys</p>
<p>—&gt; Login using EC2-A Private key</p>
<h3 id="heading-second-method-aws-ssm-most-used"><strong>Second Method: AWS SSM (Most used)</strong></h3>
<p>Enable SSM Agent</p>
<p>Attach IAM role</p>
<p>Login without SSH or keys</p>
<h2 id="heading-production-best-practices">🔐 Production Best Practices</h2>
<ul>
<li><p>Disable password login</p>
</li>
<li><p>Use key-based auth only</p>
</li>
<li><p>Restrict SSH IPs</p>
</li>
<li><p>Rotate keys</p>
</li>
<li><p>Prefer AWS SSM</p>
</li>
</ul>
]]></content:encoded></item></channel></rss>