<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: gautam-droid</title>
    <description>The latest articles on Forem by gautam-droid (@gautamdroid_49).</description>
    <link>https://forem.com/gautamdroid_49</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1050844%2Fab33492c-4cf8-41fd-9531-1883a73e0e1a.png</url>
      <title>Forem: gautam-droid</title>
      <link>https://forem.com/gautamdroid_49</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/gautamdroid_49"/>
    <language>en</language>
    <item>
      <title>🔑 Setting Up SSH Key-Based Authentication</title>
      <dc:creator>gautam-droid</dc:creator>
      <pubDate>Tue, 01 Apr 2025 06:06:04 +0000</pubDate>
      <link>https://forem.com/gautamdroid_49/setting-up-ssh-key-based-authentication-4p61</link>
      <guid>https://forem.com/gautamdroid_49/setting-up-ssh-key-based-authentication-4p61</guid>
      <description>&lt;p&gt;&lt;strong&gt;Before Proceeding&lt;/strong&gt; ⏳👉 If you're interested in learning how to retrieve a &lt;strong&gt;username&lt;/strong&gt; and &lt;strong&gt;IP&lt;/strong&gt;, be sure to check out my &lt;strong&gt;first post&lt;/strong&gt; for a &lt;strong&gt;detailed explanation&lt;/strong&gt;! 🔍💡&lt;br&gt;
&lt;a href="https://dev.to/gautamdroid_49/how-to-login-into-a-remote-server-using-ssh-with-user-login-username-and-password-4pga"&gt;How to log in to a remote server using SSH with a username and password&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;1️⃣ Start the SSH Server on the Host Machine&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;🚀 Run the following command on your &lt;strong&gt;host machine&lt;/strong&gt; to start the SSH server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔍 To check the status, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  &lt;strong&gt;2️⃣ Generate an SSH Key on the Client Machine&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;✅ &lt;strong&gt;Before proceeding, check if any key is present in the host machine's &lt;code&gt;.ssh&lt;/code&gt; folder:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/.ssh
&lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If there are any keys present, like &lt;code&gt;id_rsa&lt;/code&gt;, &lt;code&gt;id_ed25519&lt;/code&gt;, or any other name, choose a different file name unless you want to overwrite it.&lt;/p&gt;

&lt;p&gt;💻 Now, on your &lt;strong&gt;client&lt;/strong&gt; machine (yes, you heard it right), generate an SSH key pair by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;ssh-keygen &lt;span class="nt"&gt;-b&lt;/span&gt; 4096
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;ℹ️ Note:&lt;/strong&gt; The &lt;code&gt;-b&lt;/code&gt; flag specifies the key length in bits (4096 in this case).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp1eqq51be1d9ebmkooos.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp1eqq51be1d9ebmkooos.jpg" alt="generate key" width="720" height="1038"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ When prompted for the filename, &lt;strong&gt;hit enter&lt;/strong&gt; to use the default location (&lt;code&gt;~/.ssh/id_rsa&lt;/code&gt;) if no existing keys are present.  &lt;/p&gt;

&lt;p&gt;For a &lt;strong&gt;passphrase&lt;/strong&gt;, if you don’t want one, hit &lt;strong&gt;Enter&lt;/strong&gt; ✅🔑&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpg6d931wslp3f1ik9jsy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpg6d931wslp3f1ik9jsy.jpg" alt="press enter" width="720" height="1043"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⚠️ If a file already exists in &lt;code&gt;~/.ssh/&lt;/code&gt;, it's recommended to specify a &lt;strong&gt;custom filename&lt;/strong&gt; (don't forget to provide the full path, or it will be created in your current directory):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;~/.ssh/customFileName
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🎯 Press &lt;strong&gt;enter&lt;/strong&gt; to continue.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;3️⃣ Copy the Public Key to the Host Machine&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;💡 &lt;strong&gt;Tip:&lt;/strong&gt; It doesn't matter where you generate the key. What matters is that the &lt;strong&gt;private key&lt;/strong&gt; should remain on the client machine, and the &lt;strong&gt;public key&lt;/strong&gt; should be on the host machine. If needed, you can also transfer it manually.&lt;/p&gt;

&lt;p&gt;📤 To copy the &lt;strong&gt;public key&lt;/strong&gt; to the host machine from the client machine, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-copy-id &lt;span class="nt"&gt;-i&lt;/span&gt; ~/.ssh/customFileName.pub username@ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📌 This command specifies which &lt;strong&gt;public key&lt;/strong&gt; to send to the host machine. In turn, it will be added to &lt;code&gt;~/.ssh/authorized_keys&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1isjykjomjywj7kl8n2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1isjykjomjywj7kl8n2.jpg" alt="copy public key" width="720" height="1043"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔄 Alternatively, if you want to &lt;strong&gt;automatically pick the default public key&lt;/strong&gt; from &lt;code&gt;~/.ssh/&lt;/code&gt;, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-copy-id username@ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  &lt;strong&gt;4️⃣ Verify the Key on the Host Machine (Optional)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;🛠️ On your &lt;strong&gt;host machine&lt;/strong&gt;, check if the key was copied successfully:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ~/.ssh/authorized_keys
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftv5iicnmdyopqny2n6xp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftv5iicnmdyopqny2n6xp.png" alt="verify public key" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The key in this file should be exactly the same as the public key on your client machine. If there are multiple keys, look for the one that matches your public key.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;5️⃣ Log in to the Host Machine from the Client Machine&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;🔑 Now, try logging into your host machine from the client machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh username@ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frugz48jde21lsiw9elli.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frugz48jde21lsiw9elli.jpg" alt="Logging IN" width="720" height="1043"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔐 The &lt;strong&gt;first attempt&lt;/strong&gt; will still ask for a password.&lt;br&gt;&lt;br&gt;
🎉 On the &lt;strong&gt;second attempt&lt;/strong&gt;, key-based authentication should work.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hm1yzd9gt05t0vr4dtq.jpg" alt="successful authentication" width="720" height="958"&gt;
&lt;/h2&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;⚠️ Troubleshooting: Still Asking for Password?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If SSH &lt;strong&gt;still&lt;/strong&gt; prompts for a password after the first attempt:&lt;/p&gt;

&lt;p&gt;1️⃣ On your &lt;strong&gt;host machine&lt;/strong&gt;, edit the SSH configuration file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nvim /etc/ssh/sshd_config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2️⃣ 🔎 Search for the following settings and update them if necessary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PasswordAuthentication&lt;/strong&gt; → Change &lt;code&gt;yes&lt;/code&gt; to &lt;code&gt;no&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6sc9f3m9itlpb5vz2id.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6sc9f3m9itlpb5vz2id.png" alt="Password Authentication" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public Key Authentication&lt;/strong&gt; → Change &lt;code&gt;no&lt;/code&gt; to &lt;code&gt;yes&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67o10r01zc30ol2fjlql.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67o10r01zc30ol2fjlql.png" alt="publicKeyAuthentication" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AuthorizedKeysFile&lt;/strong&gt; → Uncomment this line&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixjtrzoxuic0mowty4ao.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixjtrzoxuic0mowty4ao.png" alt="Authorized Keys File" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3️⃣ 💾 Save and exit (&lt;code&gt;:wq&lt;/code&gt; in &lt;code&gt;nvim&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffw423qgkgzmxed5vhk4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffw423qgkgzmxed5vhk4s.png" alt="save and exit" width="800" height="39"&gt;&lt;/a&gt;&lt;br&gt;
4️⃣ 🔄 Restart the SSH server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi6fl83g80ofckh7k3i2d.png" alt="restart ssh server" width="800" height="449"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;🎉 You're Done!&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;✅ Now, you should be able to log in &lt;strong&gt;without a password&lt;/strong&gt; using SSH key-based authentication. 🚀&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thank you all&lt;/strong&gt; for taking the time to read this &lt;strong&gt;post&lt;/strong&gt;! 🙌 &lt;br&gt;
I truly appreciate your support and hope you found it &lt;strong&gt;helpful&lt;/strong&gt;. 🚀  &lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>learning</category>
      <category>cloud</category>
    </item>
    <item>
      <title>🖥️ HOW TO LOGIN INTO A REMOTE SERVER USING SSH WITH USER LOGIN (USERNAME AND PASSWORD)</title>
      <dc:creator>gautam-droid</dc:creator>
      <pubDate>Tue, 01 Apr 2025 05:44:09 +0000</pubDate>
      <link>https://forem.com/gautamdroid_49/how-to-login-into-a-remote-server-using-ssh-with-user-login-username-and-password-4pga</link>
      <guid>https://forem.com/gautamdroid_49/how-to-login-into-a-remote-server-using-ssh-with-user-login-username-and-password-4pga</guid>
      <description>&lt;h2&gt;
  
  
  🔹 Step 1: Install Required Packages
&lt;/h2&gt;

&lt;p&gt;📥 Install &lt;strong&gt;OpenSSH Server&lt;/strong&gt; (for self-hosting your Linux distro) or &lt;strong&gt;Dropbear&lt;/strong&gt; (a lightweight SSH server and client).&lt;/p&gt;

&lt;p&gt;To install OpenSSH Server:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Debian/Ubuntu:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;openssh-server &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Arch Linux:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;sudo &lt;/span&gt;pacman &lt;span class="nt"&gt;-S&lt;/span&gt; openssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fedora:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install &lt;/span&gt;openssh-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CentOS/RHEL:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;sudo &lt;/span&gt;yum &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; openssh-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔹 &lt;strong&gt;Note:&lt;/strong&gt; For Dropbear, replace &lt;code&gt;openssh-server&lt;/code&gt; with &lt;code&gt;dropbear&lt;/code&gt; in the installation commands.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔹 Step 2: Check SSH Server Status
&lt;/h2&gt;

&lt;p&gt;🛠️ Run the following command to check the status:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you are using &lt;strong&gt;Dropbear&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status dropbear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If you are using &lt;strong&gt;OpenSSH Server&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffvd40rahfw4pwt0ezcc1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffvd40rahfw4pwt0ezcc1.jpg" alt="Check status" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⚡ In the further steps, we will continue with &lt;strong&gt;OpenSSH&lt;/strong&gt;. Everything will be the same for &lt;strong&gt;Dropbear&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔹 Step 3: Start the SSH Server (If Inactive)
&lt;/h2&gt;

&lt;p&gt;🚀 If the status shows &lt;strong&gt;inactive&lt;/strong&gt;, start the server using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(Replace "start" with "stop" to stop the server.)&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbnmz6u2mt7h16lwcpyvt.png" alt="starting and checking status of ssh server" width="800" height="449"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🔹 Step 4: Open a Terminal for Connection
&lt;/h2&gt;

&lt;p&gt;🖥️ Open a &lt;strong&gt;new terminal&lt;/strong&gt;,&lt;strong&gt;PuTTY&lt;/strong&gt;, &lt;strong&gt;Termux&lt;/strong&gt;, or any other terminal to connect to the host computer.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F02nxfmxeg3a8o15zc4s2.jpg" alt="Here we are using termux" width="558" height="808"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🔹 Step 5: Find the Host's IP and Username
&lt;/h2&gt;

&lt;p&gt;🌐 To get the &lt;strong&gt;IP address&lt;/strong&gt;, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  ifconfig
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔍 Search for &lt;strong&gt;"inet"&lt;/strong&gt;—the digits following the colon are the &lt;strong&gt;user’s IP(private)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fln7425byfc4gatmnmq3r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fln7425byfc4gatmnmq3r.png" alt="check your private ip" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👤 To get the &lt;strong&gt;username&lt;/strong&gt;, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;whoami&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8zkgkiyhmnluj6jbvxs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8zkgkiyhmnluj6jbvxs.png" alt="check username" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📌 &lt;strong&gt;Note:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the &lt;strong&gt;client and host are on the same network&lt;/strong&gt; (e.g., same WiFi router), use the &lt;strong&gt;local IP&lt;/strong&gt; to connect.&lt;/li&gt;
&lt;li&gt;If the &lt;strong&gt;client and host are on different networks&lt;/strong&gt; (e.g., the host is on home WiFi and the client is on cellular data or different WiFi), use the &lt;strong&gt;public IP&lt;/strong&gt; of the host. Get it by visiting &lt;a href="https://www.whatismyip.com/" rel="noopener noreferrer"&gt;WhatIsMyIP.com&lt;/a&gt; on the &lt;strong&gt;host machine&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ensure port forwarding for port 22&lt;/strong&gt; on your &lt;strong&gt;host machine’s WiFi router&lt;/strong&gt; to allow the connection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignore port forwarding if on the same network&lt;/strong&gt;, as you can directly connect using the host machine’s private IP.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcxd3wj24bn4f9ewkz2n8.png" alt="Retrieve your public ip" width="800" height="449"&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; My host is connected to a WiFi router, and my client machine (phone) is on a cellular network, so I need to consider my public IP.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔹 Step 6: Connect to the Remote Server
&lt;/h2&gt;

&lt;p&gt;🔑 Run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh username@ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhiree2kd4qkibjn3v0mi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhiree2kd4qkibjn3v0mi.jpg" alt="connecting to host" width="558" height="806"&gt;&lt;/a&gt;&lt;br&gt;
🔐 You will be asked for a &lt;strong&gt;password&lt;/strong&gt; to run the &lt;code&gt;sudo&lt;/code&gt; command and another &lt;strong&gt;password&lt;/strong&gt; to log into the server.&lt;/p&gt;


&lt;h2&gt;
  
  
  🔹 Step 7: Log into the Server
&lt;/h2&gt;

&lt;p&gt;💻 Now, connect to the server using the command from &lt;strong&gt;Step 6&lt;/strong&gt;, replacing it with the host’s &lt;strong&gt;username&lt;/strong&gt; and &lt;strong&gt;IP&lt;/strong&gt;, then enter the &lt;strong&gt;password&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Type &lt;strong&gt;Yes&lt;/strong&gt;, here!!! ✅🎯&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhnynt4afb44cdju3ivj7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhnynt4afb44cdju3ivj7.jpg" alt="Loggin in" width="558" height="804"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter the password and hit &lt;strong&gt;Enter&lt;/strong&gt; 🔑➡️⏎&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8rfv2twwmd9gvbn4nfis.jpg" alt="type password" width="559" height="1280"&gt;
&lt;/h2&gt;
&lt;h2&gt;
  
  
  🔹 Step 8: Verify the SSH Connection
&lt;/h2&gt;

&lt;p&gt;🔍 To check if the connection is active, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;who&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fegysgerxn6i2237iuod9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fegysgerxn6i2237iuod9.png" alt="check active connected users" width="800" height="449"&gt;&lt;/a&gt;&lt;br&gt;
📋 It will show a &lt;strong&gt;list of users&lt;/strong&gt; currently using your distro.&lt;br&gt;
Look for something like &lt;strong&gt;/pts/0&lt;/strong&gt; or &lt;strong&gt;/pts/any_number&lt;/strong&gt;—if it's present, your session is &lt;strong&gt;active&lt;/strong&gt;, or a user is &lt;strong&gt;logged in&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  🔹 Step 9: Kill an Active SSH Connection (If Needed)
&lt;/h2&gt;

&lt;p&gt;⚠️ To &lt;strong&gt;terminate&lt;/strong&gt; a particular SSH session, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;sudo &lt;/span&gt;fuser &lt;span class="nt"&gt;-k&lt;/span&gt; /dev/pts/&amp;lt;the_number&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔌 This will &lt;strong&gt;disconnect&lt;/strong&gt; the user from the SSH session.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkgn99p41coplchuyisrq.png" alt="killing an user session" width="800" height="449"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🔹 Step 10: Confirm Disconnection
&lt;/h2&gt;

&lt;p&gt;🔁 Again, check the &lt;strong&gt;active connections&lt;/strong&gt; using the &lt;code&gt;who&lt;/code&gt; command.(Look at the above screenshot 👆👆👆)&lt;/p&gt;

&lt;p&gt;A message appears showing the connection has been closed  👇👇👇&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fabb7knpfu4qogxckcq23.jpg" alt="ensuring proper disconnection" width="558" height="810"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🔹 Step 11: Logout or Stop the SSH Server
&lt;/h2&gt;

&lt;p&gt;🔓 To &lt;strong&gt;log out&lt;/strong&gt;, type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="nb"&gt;exit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa94psj68mor86757lzn0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa94psj68mor86757lzn0.jpg" alt="run the command to exit" width="556" height="808"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Successfully exited!!&lt;/strong&gt; ✅🚪&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F13t3wxt7ii78dzsgfz55.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F13t3wxt7ii78dzsgfz55.jpg" alt="finally exited" width="554" height="808"&gt;&lt;/a&gt;&lt;br&gt;
⛔ To &lt;strong&gt;stop the SSH server&lt;/strong&gt;, run the command listed in &lt;strong&gt;Step 2&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;Thanks for reading! 🎉 You've now set up an SSH server, connected remotely, and managed your sessions. Stay secure by using SSH keys (more on that in my next post—stay tuned!), disabling root login, and using firewalls or VPNs.  &lt;/p&gt;

&lt;p&gt;If connecting over the internet, be mindful of your public IP, enable port forwarding, and use strong passwords or SSH keys.  &lt;/p&gt;

&lt;p&gt;Got questions? Drop a comment! Don't forget to &lt;strong&gt;follow&lt;/strong&gt; for more tech guides. Happy SSH-ing! 🚀🔑&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>learning</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
