<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Neeraj Kumar - Posts</title>
    <subtitle>A blog for sharing my thoughts, ideas, and experiences on software development, technology, and life in general.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://drunktrader.dev/posts/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://drunktrader.dev/posts/"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-09-06T00:00:00+00:00</updated>
    <id>https://drunktrader.dev/posts/atom.xml</id>
    <entry xml:lang="en">
        <title>SSHing Into My Home Server, From Anywhere</title>
        <published>2026-09-06T00:00:00+00:00</published>
        <updated>2026-09-06T00:00:00+00:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://drunktrader.dev/posts/tailscale-in-home-server/"/>
        <id>https://drunktrader.dev/posts/tailscale-in-home-server/</id>
        
        <content type="html" xml:base="https://drunktrader.dev/posts/tailscale-in-home-server/">&lt;p&gt;I have a headless server sitting at home.&lt;/p&gt;
&lt;p&gt;No monitor. No keyboard. No particular interest in giving it either.&lt;/p&gt;
&lt;p&gt;The problem with a headless server is fairly obvious: eventually, you need to talk to it.&lt;/p&gt;
&lt;p&gt;I wanted to SSH into it from my laptop when I was away from home. The traditional solution would be to expose port &lt;code&gt;22&lt;/code&gt; on my router and forward it to the server.&lt;/p&gt;
&lt;p&gt;That works.&lt;/p&gt;
&lt;p&gt;It also means putting an SSH service on the public internet and then spending the rest of your life making sure nobody interesting finds it.&lt;/p&gt;
&lt;p&gt;There was a simpler solution.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://tailscale.com/&quot;&gt;Tailscale&lt;/a&gt; creates a private WireGuard-based network between my devices. My laptop and home server can talk to each other as if they were sitting on the same network, even when they aren’t.&lt;/p&gt;
&lt;p&gt;So I installed Tailscale on both.&lt;/p&gt;
&lt;p&gt;On the home server:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt;fsSL&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; https://tailscale.com/install.sh&lt;/span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F47067);&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt; sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; tailscale&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; up&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And the same on my laptop.&lt;/p&gt;
&lt;p&gt;Once authenticated, the server showed up with its Tailscale IP:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;100.99.XX.XX&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That’s the important part.&lt;/p&gt;
&lt;p&gt;I don’t need to know my home router’s public IP. I don’t need to configure port forwarding. I don’t need to expose SSH to the internet.&lt;/p&gt;
&lt;p&gt;I just SSH into the Tailscale address:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;ssh&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; drunktrader@100.99.XX.XX&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And I’m in.&lt;/p&gt;
&lt;p&gt;The nice thing about this setup is that SSH itself doesn’t really know—or care—that Tailscale is involved.&lt;/p&gt;
&lt;p&gt;From SSH’s perspective, this is just another IP address.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; ip&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; addr&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; show&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; tailscale0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt;.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;inet&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; 100.99.XX.XX/32&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; scope&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; global&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; tailscale0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/images/og/p1_tailscale_img.png&quot; alt=&quot;LogChef skill in action&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Tailscale provides the network.&lt;/p&gt;
&lt;p&gt;SSH provides the conversation.&lt;/p&gt;
&lt;p&gt;Linux does the rest.&lt;/p&gt;
&lt;h3 id=&quot;the-headless-part&quot;&gt;The headless part&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-headless-part&quot; aria-label=&quot;Anchor link for: the-headless-part&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;This becomes particularly useful when the server is doing something I don’t want to interrupt.&lt;/p&gt;
&lt;p&gt;I can connect remotely:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;ssh&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; drunktrader@100.99.XX.XX&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;check what’s running:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;systemctl&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt;-type=service&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt;-state=running&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;inspect processes:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;htop&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or just move files around with &lt;code&gt;scp&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;scp&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; ./file.txt&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; drunktrader@100.99.XX.XX:/home/drunktrader/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For larger files, the same idea applies.&lt;/p&gt;
&lt;p&gt;At one point I needed to access a media file sitting on the server. Instead of turning the server into a public file server, I could simply use the existing Tailscale connection.&lt;/p&gt;
&lt;p&gt;That’s the pattern I keep coming back to:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If the machine is already on my private network, why make the service public?&lt;/strong&gt;&lt;/p&gt;
&lt;h3 id=&quot;tailscale-ssh&quot;&gt;Tailscale SSH&lt;a class=&quot;zola-anchor&quot; href=&quot;#tailscale-ssh&quot; aria-label=&quot;Anchor link for: tailscale-ssh&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Tailscale can also handle SSH itself, which removes some of the traditional SSH configuration.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;tailscale&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; up&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #6CB6FF);&quot;&gt;-ssh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This allows Tailscale to provide SSH access between devices in the tailnet.&lt;/p&gt;
&lt;p&gt;But for my setup, regular OpenSSH over the Tailscale interface is perfectly sufficient.&lt;/p&gt;
&lt;p&gt;I still get the familiar workflow:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;ssh&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; user@100.x.x.x&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The difference is where that packet goes.&lt;/p&gt;
&lt;p&gt;It stays inside the Tailscale network rather than asking my home router to expose port &lt;code&gt;22&lt;/code&gt; to everyone.&lt;/p&gt;
&lt;h3 id=&quot;finding-the-server&quot;&gt;Finding the server&lt;a class=&quot;zola-anchor&quot; href=&quot;#finding-the-server&quot; aria-label=&quot;Anchor link for: finding-the-server&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When I forget the Tailscale IP, I don’t need to guess.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;tailscale&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; status&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;gives me the devices connected to my tailnet:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;100.xx.xx.xx   laptop        ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;100.99.XX.XX   home-server   linux&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I can then connect directly:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;ssh&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; drunktrader@100.99.XX.XX&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Nothing particularly clever is happening here.&lt;/p&gt;
&lt;p&gt;That’s the point.&lt;/p&gt;
&lt;h3 id=&quot;a-small-mental-model&quot;&gt;A small mental model&lt;a class=&quot;zola-anchor&quot; href=&quot;#a-small-mental-model&quot; aria-label=&quot;Anchor link for: a-small-mental-model&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The setup is basically:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                 Tailscale&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ┌─────────────────────────┐&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        │                         │&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        │                         │&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Laptop                    Home Server&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   100.x.x.x                  100.99.XX.XX&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        │                         │&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        └────────── SSH ──────────┘&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The server doesn’t need a public SSH endpoint.&lt;/p&gt;
&lt;p&gt;Both machines only need to be reachable through the same tailnet.&lt;/p&gt;
&lt;p&gt;And because Tailscale handles NAT traversal and encrypted connectivity, the annoying networking details mostly disappear from the workflow.&lt;/p&gt;
&lt;p&gt;The result is pleasantly uneventful.&lt;/p&gt;
&lt;p&gt;I’m somewhere else.&lt;/p&gt;
&lt;p&gt;I open a terminal.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #ADBAC7); background-color: light-dark(#FFFFFF, #22272E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #F69D50);&quot;&gt;ssh&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #96D0FF);&quot;&gt; drunktrader@100.99.XX.XX&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And my home server is there.&lt;/p&gt;
&lt;p&gt;No port forwarding.&lt;/p&gt;
&lt;p&gt;No public SSH port.&lt;/p&gt;
&lt;p&gt;No hunting for the home IP.&lt;/p&gt;
&lt;p&gt;Just SSH.&lt;/p&gt;
&lt;p&gt;Fin.&lt;/p&gt;
</content>
        
    </entry>
</feed>
