<?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>DEV Community: Mohammad Alsaraf</title>
    <description>The latest articles on DEV Community by Mohammad Alsaraf (@sarrph).</description>
    <link>https://dev.to/sarrph</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3844553%2Fac09d4a6-e95b-4b1b-a898-a8d482538732.png</url>
      <title>DEV Community: Mohammad Alsaraf</title>
      <link>https://dev.to/sarrph</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sarrph"/>
    <language>en</language>
    <item>
      <title>Why did my app stop? Read your server's logs with journalctl</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Thu, 19 Nov 2026 10:35:55 +0000</pubDate>
      <link>https://dev.to/sarrph/why-did-my-app-stop-read-your-servers-logs-with-journalctl-494h</link>
      <guid>https://dev.to/sarrph/why-did-my-app-stop-read-your-servers-logs-with-journalctl-494h</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fatz1wlc7qe0lncncz4s6.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fatz1wlc7qe0lncncz4s6.png" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your bot went quiet or your site stopped answering. The reason is almost always written down in the system journal, and &lt;code&gt;journalctl&lt;/code&gt; is how you read it. We will follow a real example: an app that refuses to start, twice for two different reasons.&lt;/p&gt;

&lt;p&gt;About 10 minutes. For Debian, Ubuntu and AlmaLinux, which use systemd. Alpine does not use systemd, so this guide does not apply there.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Ask systemd what is wrong
&lt;/h2&gt;

&lt;p&gt;If your app runs as a service (if not, &lt;a href="https://natbox.io/guides/run-an-app" rel="noopener noreferrer"&gt;here is how&lt;/a&gt;), start with &lt;code&gt;systemctl status&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcxhcm1r9kd32cyxn2xgi.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcxhcm1r9kd32cyxn2xgi.png" alt="systemctl status shows myapp activating, auto-restart, exit code 203/EXEC" width="800" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;activating (auto-restart)&lt;/em&gt; means it crashes and systemd keeps trying again. The status line only says &lt;em&gt;203/EXEC&lt;/em&gt;. The journal says more.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Read the service's own log
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;journalctl -u myapp -n 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-u&lt;/code&gt; picks one service, &lt;code&gt;-n 5&lt;/code&gt; shows the last five lines.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1e6a8i0y85rsh26bvu8z.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1e6a8i0y85rsh26bvu8z.png" alt="journalctl shows: Failed to locate executable /usr/bin/python3: No such file or directory" width="800" height="179"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Our Debian image is kept small, so Python is not installed until you need it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Clear enough: Python is not installed. &lt;code&gt;apt install -y python3&lt;/code&gt; fixes that, and systemd starts the app again by itself a few seconds later.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. The next error: a Python traceback
&lt;/h2&gt;

&lt;p&gt;It still crashes, but the journal now shows the app's own error output:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F256eztr83o53vjdlb3lc.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F256eztr83o53vjdlb3lc.png" alt="journalctl shows a Python traceback ending in KeyError: DATABASE_URL" width="799" height="257"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read a traceback from the bottom up: &lt;code&gt;KeyError: 'DATABASE_URL'&lt;/code&gt;. The app expects a setting that the service does not give it.&lt;/p&gt;
&lt;h2&gt;
  
  
  4. Fix it and check
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;systemctl edit myapp&lt;/code&gt; opens an empty override file. Add the setting there, save, then restart and look again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight systemd"&gt;&lt;code&gt;&lt;span class="k"&gt;[Service]&lt;/span&gt;
&lt;span class="na"&gt;Environment&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;DATABASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;postgresql&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//app:secret@localhost/app&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl610rqncn6udtx62nzls.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl610rqncn6udtx62nzls.png" alt="After the fix, journalctl shows the app connected and handling requests" width="799" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It runs. For real passwords, use &lt;code&gt;EnvironmentFile=/etc/myapp.env&lt;/code&gt; with &lt;code&gt;chmod 600&lt;/code&gt; on that file, as in the &lt;a href="https://natbox.io/guides/discord-bot" rel="noopener noreferrer"&gt;Discord bot guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Useful filters
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;journalctl -u myapp -f&lt;/code&gt;: follow live, like &lt;code&gt;tail -f&lt;/code&gt;. Ctrl+C to stop.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;journalctl -u myapp --since "1 hour ago"&lt;/code&gt; or &lt;code&gt;--since today&lt;/code&gt;: a time window.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;journalctl -p err -b&lt;/code&gt;: only errors, since the last boot.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;journalctl -b -1&lt;/code&gt;: the previous boot, to see what happened before a restart.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;journalctl --disk-usage&lt;/code&gt; and &lt;code&gt;--vacuum-size=50M&lt;/code&gt;: see and limit how much space logs take.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bonus: who is trying to log in?
&lt;/h2&gt;

&lt;p&gt;The SSH log shows every failed login. Here are three attempts with made-up user names, which is exactly what password-guessing bots look like:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl8emrndlo3nsun5x4uhi.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl8emrndlo3nsun5x4uhi.png" alt="journalctl for ssh shows Invalid user test and Invalid user admin lines" width="800" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you see many of these, use SSH keys and fail2ban: see &lt;a href="https://natbox.io/guides/ssh-keys" rel="noopener noreferrer"&gt;SSH keys&lt;/a&gt; and &lt;a href="https://natbox.io/guides/fail2ban" rel="noopener noreferrer"&gt;fail2ban&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get new tutorials in Telegram.&lt;/strong&gt; Follow &lt;a href="https://t.me/natboxio" rel="noopener noreferrer"&gt;@natboxio&lt;/a&gt;: every new post, plus short server tips.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Run Claude Code 24/7 on a $2.25/month server</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Sat, 14 Nov 2026 06:27:29 +0000</pubDate>
      <link>https://dev.to/sarrph/run-claude-code-247-on-a-225month-server-8co</link>
      <guid>https://dev.to/sarrph/run-claude-code-247-on-a-225month-server-8co</guid>
      <description>&lt;p&gt;When Claude Code runs on your laptop, a long task stops when the lid closes. On a small always-on server it keeps working, and you can check in from any device over SSH. A cheap &lt;strong&gt;NAT VPS&lt;/strong&gt; is enough, because the agent only makes outbound connections.&lt;/p&gt;

&lt;p&gt;I use &lt;a href="https://natbox.io/" rel="noopener noreferrer"&gt;natbox.io&lt;/a&gt;'s Box Plus plan ($2.25/month: 2 GB RAM, 2 shared cores, 20 GB SSD). &lt;strong&gt;Disclosure: I run natbox.&lt;/strong&gt; Claude Code uses your own Claude account, so you need an account that includes it. The manual steps work on any Debian or Ubuntu server.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Get a server
&lt;/h2&gt;

&lt;p&gt;Order Box Plus (or bigger) with Debian or Ubuntu. Box Plus is the smallest natbox plan that supports the AI agent apps.&lt;/p&gt;

&lt;h2&gt;
  
  
  2a. The quick way: one-click Claude Code
&lt;/h2&gt;

&lt;p&gt;Pick the Claude Code app in the client area. It installs Claude Code on your server, and you sign in with your Claude account on first run. The same plan also offers one-click Codex CLI, OpenClaw and Hermes Agent if you want to compare agents.&lt;/p&gt;

&lt;h2&gt;
  
  
  2b. The manual way
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh root@natbox.io -p &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;your-first-port&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt install -y git tmux curl
curl -fsSL https://claude.ai/install.sh &lt;span class="o"&gt;|&lt;/span&gt; bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Check Anthropic's Claude Code docs for the current install command; it occasionally changes.)&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Keep sessions alive with tmux
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tmux new -s claude
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/your-project
claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first run prints a sign-in link. Open it on any device, approve, and you're in. Detach with &lt;code&gt;Ctrl-b d&lt;/code&gt;. Later, reconnect over SSH and run &lt;code&gt;tmux attach -t claude&lt;/code&gt; to pick up where the agent left off.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Optional: an editor in the browser
&lt;/h2&gt;

&lt;p&gt;Add the one-click code-server app (VS Code in the browser, password protected) to review the agent's changes from a tablet or a borrowed computer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Good to know
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Every server gets a routed /80 of IPv6 that isn't filtered, so set up a firewall (&lt;code&gt;ufw default deny incoming&lt;/code&gt;, then allow your SSH port).&lt;/li&gt;
&lt;li&gt;No Docker or nested containers (servers are LXC), so projects that need Docker for tests won't run here.&lt;/li&gt;
&lt;li&gt;Use is for personal projects under natbox's Acceptable Use Policy.&lt;/li&gt;
&lt;li&gt;If traffic goes over the monthly allowance, it's slowed to 10 Mbit/s rather than cut off.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>devtools</category>
      <category>linux</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Host a Discord bot 24/7 for $1/month on a NAT VPS</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Sat, 14 Nov 2026 06:26:42 +0000</pubDate>
      <link>https://dev.to/sarrph/host-a-discord-bot-247-for-1month-on-a-nat-vps-42dk</link>
      <guid>https://dev.to/sarrph/host-a-discord-bot-247-for-1month-on-a-nat-vps-42dk</guid>
      <description>&lt;p&gt;A Discord bot never waits for incoming connections. It opens a connection to Discord and keeps it alive. That means it doesn't need its own IPv4 address. A &lt;strong&gt;NAT VPS&lt;/strong&gt;, which shares one IPv4 address between customers and gives each server a block of ports, runs a bot just as well as a full VPS for a fraction of the price. Free bot hosts tend to sleep or restart your bot; a small VPS keeps it running and gives you root.&lt;/p&gt;

&lt;p&gt;In this guide I use &lt;a href="https://natbox.io/" rel="noopener noreferrer"&gt;natbox.io&lt;/a&gt;'s Nano plan ($1/month: 512 MB RAM, 5 GB SSD, 10 ports). &lt;strong&gt;Disclosure: I run natbox.&lt;/strong&gt; The manual steps work on any Debian or Ubuntu server.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create the bot in Discord
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open the Discord Developer Portal and create a new application.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Bot&lt;/strong&gt;, reset and copy the token. Treat it like a password.&lt;/li&gt;
&lt;li&gt;If your bot reads message text, turn on &lt;strong&gt;Message Content Intent&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;OAuth2 → URL Generator&lt;/strong&gt;, tick &lt;code&gt;bot&lt;/code&gt;, choose permissions, and open the link to invite the bot to your server.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  2. Get a server
&lt;/h2&gt;

&lt;p&gt;Order a Nano plan with Debian or Ubuntu. It's ready in under a minute. New customers can use the free one-month trial instead (256 MB RAM, 3 GB SSD, 5 ports, no payment details needed), which is enough for a small bot.&lt;/p&gt;

&lt;h2&gt;
  
  
  3a. The quick way: one-click Discord bot
&lt;/h2&gt;

&lt;p&gt;natbox has a one-click Discord bot app. It installs a ready Python bot; you paste your bot token in the client area and it stays online 24/7. Use it if you want a running bot in two minutes and plan to edit the code afterwards.&lt;/p&gt;

&lt;h2&gt;
  
  
  3b. The manual way: your own code
&lt;/h2&gt;

&lt;p&gt;Connect over SSH. Your login and port are in the client area; SSH listens on the first port of your block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh root@natbox.io -p &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;your-first-port&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Python and create a project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt install -y python3 python3-venv
mkdir -p /opt/bot &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /opt/bot
python3 -m venv venv
./venv/bin/pip install -U discord.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;/opt/bot/bot.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;discord&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;discord&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ext&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;commands&lt;/span&gt;

&lt;span class="n"&gt;intents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;discord&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Intents&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;intents&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message_content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;
&lt;span class="n"&gt;bot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Bot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command_prefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"!"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;intents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;intents&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@bot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ping&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"pong"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"DISCORD_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Store the token outside the code:&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;echo&lt;/span&gt; &lt;span class="s1"&gt;'DISCORD_TOKEN=paste-your-token-here'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /opt/bot/.env
chmod 600 /opt/bot/.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Keep it running with systemd
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;/etc/systemd/system/discord-bot.service&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;Discord&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;
&lt;span class="na"&gt;After&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;network&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;online&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;

&lt;span class="k"&gt;[Service]&lt;/span&gt;
&lt;span class="na"&gt;WorkingDirectory&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="n"&gt;opt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;bot&lt;/span&gt;
&lt;span class="na"&gt;EnvironmentFile&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="n"&gt;opt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;
&lt;span class="na"&gt;ExecStart&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="n"&gt;opt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;venv&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;
&lt;span class="na"&gt;Restart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;always&lt;/span&gt;
&lt;span class="na"&gt;RestartSec&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;

&lt;span class="k"&gt;[Install]&lt;/span&gt;
&lt;span class="na"&gt;WantedBy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;multi&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then start it and enable it at boot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl daemon-reload
systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; --now discord-bot
journalctl -u discord-bot -f
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Type &lt;code&gt;!ping&lt;/code&gt; in your server. The bot should answer &lt;code&gt;pong&lt;/code&gt;. If it crashes, systemd restarts it within five seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Lock it down
&lt;/h2&gt;

&lt;p&gt;Every natbox server gets its own routed /80 of IPv6, which is reachable on every port and isn't filtered. A bot needs no inbound ports, so allow SSH and nothing else:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt install -y ufw
ufw default deny incoming
ufw allow &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;your-ssh-port&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/tcp
ufw &lt;span class="nb"&gt;enable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Good to know
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Outbound mail on ports 25, 465 and 587 is blocked. If your bot sends email, use an email API over HTTPS.&lt;/li&gt;
&lt;li&gt;Docker isn't supported (servers are LXC containers), so run the bot directly as shown.&lt;/li&gt;
&lt;li&gt;When you outgrow Nano, upgrade in place from the client area. Your data, IPs and ports stay the same.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>discord</category>
      <category>python</category>
      <category>selfhosted</category>
      <category>linux</category>
    </item>
    <item>
      <title>We made disk writes on natbox over 100 times faster. Here's the trade-off</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Sat, 14 Nov 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/sarrph/we-made-disk-writes-on-natbox-over-100-times-faster-heres-the-trade-off-14kn</link>
      <guid>https://dev.to/sarrph/we-made-disk-writes-on-natbox-over-100-times-faster-heres-the-trade-off-14kn</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftspwuv6vacaazgcy6oa0.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftspwuv6vacaazgcy6oa0.png" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Installing packages on a new natbox server was slower than it should have been. On a busy morning, &lt;code&gt;apt install python3-pip&lt;/code&gt; could take several minutes. We dug into why, tried the safe fixes first, and ended up making a choice we want to explain openly, because it changes what "saved to disk" means on your server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it was slow
&lt;/h2&gt;

&lt;p&gt;When a program needs data to really be on disk, for example a database committing a transaction or &lt;code&gt;dpkg&lt;/code&gt; unpacking a file, it calls &lt;code&gt;fsync&lt;/code&gt; and waits until the storage confirms. Package installs do this for every single file. So we measured how many of those forced 4 KB writes per second each layer could do:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4lyfyrtfwgpuqzoa71jm.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4lyfyrtfwgpuqzoa71jm.png" alt="Forced writes per second. Host disks: 51, 171 and 210. Our storage pool on top: 26, 61 and 118. Inside a customer server on server one: 25. After the change: 14,159, 21,069 and 15,362." width="799" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Two things stand out. First, the virtual disks our hosts run on are slow at this, and server one's is the slowest: 51 forced writes a second before anything of ours is involved. Second, our storage layer (ZFS, kept in a file on that disk) roughly halves it again, because every forced write has to be confirmed by two filesystems. Inside a server on server one that left about 25 a second. Installing a package with 6,699 files, each forced to disk, adds up.&lt;/p&gt;

&lt;h2&gt;
  
  
  The safe fixes made it worse
&lt;/h2&gt;

&lt;p&gt;We first tried the changes that keep every guarantee, on a scratch pool so that nobody's server was affected:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Telling ZFS to optimise forced writes for throughput instead of latency (&lt;code&gt;logbias=throughput&lt;/code&gt;): &lt;strong&gt;119&lt;/strong&gt; a second instead of 175. Worse.&lt;/li&gt;
&lt;li&gt;Putting the pool on a loop device with direct I/O, to skip one layer of caching: &lt;strong&gt;139&lt;/strong&gt;. Also worse.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The only way past the ceiling of the host disk would be faster disks. That is a bigger project, and it would still be limited to a few hundred forced writes a second.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we changed, and the trade-off
&lt;/h2&gt;

&lt;p&gt;On 9 November we set ZFS to &lt;code&gt;sync=disabled&lt;/code&gt; for customer servers. A forced write now returns immediately, and ZFS writes everything to disk together, about every 5 seconds, as one atomic step.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Your filesystem always stays consistent.&lt;/strong&gt; ZFS never ends up half-written, so a crash can't corrupt it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The cost:&lt;/strong&gt; if one of our host servers crashed or lost power, the last few seconds of writes could be lost, even if a program had been told they were saved. Your server would come back as if it had stopped a few seconds earlier. Databases recover from that the same way as from any crash.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Our own billing system keeps full safety.&lt;/strong&gt; Payments and invoices still wait for the disk.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We think that's the right deal for small servers: host crashes are rare, and when they happen, losing a few seconds is far better than every install and every database write being slow all the time. It is written down in our &lt;a href="https://natbox.io/docs#disk" rel="noopener noreferrer"&gt;docs&lt;/a&gt;, and if you'd rather your server kept the old behaviour, just ask: it's one setting per server.&lt;/p&gt;

&lt;h2&gt;
  
  
  The results
&lt;/h2&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa2xi4ght6ogrhvpiae6x.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa2xi4ght6ogrhvpiae6x.png" alt="Installing python3-pip, 6,699 files: before 374 and 60 seconds with default settings, 32 seconds with dpkg's unsafe-io option; after the change 13 to 15 seconds either way." width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Forced writes inside a server went from about 25 a second to over &lt;strong&gt;14,000&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Installing &lt;code&gt;python3-pip&lt;/code&gt; (6,699 files, packages already downloaded) on a small 1-core server took 374 and 60 seconds in two runs before, depending on what else the disk was doing. After the change it took &lt;strong&gt;13 to 15 seconds&lt;/strong&gt; , four runs in a row.&lt;/li&gt;
&lt;li&gt;On 8 November we suggested a &lt;code&gt;dpkg&lt;/code&gt; setting for faster installs. You no longer need it: with or without it, installs now take the same time. It's harmless to keep, or you can delete &lt;code&gt;/etc/dpkg/dpkg.cfg.d/unsafe-io&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nothing for you to do: the change applies to every server, including new ones and reinstalls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get new tutorials in Telegram.&lt;/strong&gt; Follow &lt;a href="https://t.me/natboxio" rel="noopener noreferrer"&gt;@natboxio&lt;/a&gt;: every new post, plus short server tips.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>performance</category>
      <category>storage</category>
      <category>devops</category>
    </item>
    <item>
      <title>Why a NAT VPS can cost $1: the economics of an IPv4 address</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Thu, 12 Nov 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/sarrph/why-a-nat-vps-can-cost-1-the-economics-of-an-ipv4-address-3fl6</link>
      <guid>https://dev.to/sarrph/why-a-nat-vps-can-cost-1-the-economics-of-an-ipv4-address-3fl6</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq4erkvv93azxixvegj47.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq4erkvv93azxixvegj47.png" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our cheapest plan costs $1.00 a month. That's less than the rent on a single IPv4 address at many providers. So how does it work? The short answer: you don't get an IPv4 address of your own. You share one, and here are the numbers behind that.&lt;/p&gt;

&lt;h2&gt;
  
  
  IPv4 addresses are scarce, and they cost money
&lt;/h2&gt;

&lt;p&gt;There are only about 4.3 billion IPv4 addresses, and the free pools ran out years ago. Today they are bought, sold and rented like property:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Buying:&lt;/strong&gt; broker reports put the average 2026 price at around &lt;strong&gt;$20 per address&lt;/strong&gt; , down from a peak of roughly $45 to $60 in 2021 and 2022 (&lt;a href="https://ipv4center.com/ipv4-market-report" rel="noopener noreferrer"&gt;IPv4Center&lt;/a&gt;, &lt;a href="https://www.ipxo.com/blog/ipv4-price-history/" rel="noopener noreferrer"&gt;IPXO&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Renting:&lt;/strong&gt; leases run at roughly &lt;strong&gt;$0.35 to $0.60 per address per month&lt;/strong&gt; on the wholesale market.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;At a hosting provider:&lt;/strong&gt; the retail price is far higher. Our own provider, Contabo, charges &lt;strong&gt;€3.50 a month&lt;/strong&gt; for one additional IPv4 address on a VPS (&lt;a href="https://help.contabo.com/support/solutions/articles/103000269701-can-i-order-additional-ip-addresses-for-my-server-" rel="noopener noreferrer"&gt;Contabo help&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These figures come mostly from brokers and vary by source and block size, so treat them as a range, not an exact price. The point stands either way: if every $1 server came with its own IPv4 address at retail prices, the address alone would cost several times the whole plan.&lt;/p&gt;

&lt;h2&gt;
  
  
  How sharing works on natbox
&lt;/h2&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3tyaa0jhkkg5pint2i0p.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3tyaa0jhkkg5pint2i0p.png" alt="One IPv4 address, 65,535 ports. Each natbox server gets its own block of ports starting at 10000: 5 on the free trial, 10 on Nano, 20 on Box, 30 on Box Plus. On 9 November 2026 one address carried 56, 31 and 14 customer servers on our three hosts." width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each of our hosts has one public IPv4 address. Every server on that host gets its own block of ports on it: 5 on the free trial, 10 on Nano, 20 on Box and Box CPU, 30 on Box Plus. The first port goes to SSH, the rest go straight to the same port numbers inside your server. On 9 November 2026 our three addresses carried &lt;strong&gt;56, 31 and 14&lt;/strong&gt; customer servers.&lt;/p&gt;

&lt;p&gt;So the cost of one address is split dozens of ways. Even at Contabo's retail €3.50, that's well under 10 cents a month per server on our busiest host. That is most of the trick behind a $1 plan.&lt;/p&gt;

&lt;p&gt;Ports 80 and 443 can't be split into blocks, because every website needs them. So we share those by domain name: you link your domain in the client area, and our proxy sends each visitor to the right server without decrypting anything (&lt;a href="https://natbox.io/blog/load-testing-our-shared-https-proxy" rel="noopener noreferrer"&gt;we load-tested it&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  What you give up
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Standard port numbers over IPv4.&lt;/strong&gt; Your SSH is on a port like 10050, not 22, and a game server or VPN runs on one of your own port numbers. Most software is happy with that. A few things, like some game clients with a fixed port, are not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only your ports.&lt;/strong&gt; Over IPv4, only the ports in your block reach your server, plus 80 and 443 for linked domains.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No outgoing mail ports.&lt;/strong&gt; Ports 25, 465 and 587 are blocked for everyone, because one spammer would get the shared address blocklisted for all.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A shared reputation.&lt;/strong&gt; If someone abuses the address, everyone on it could suffer. That's why we take abuse seriously (&lt;a href="https://natbox.io/abuse" rel="noopener noreferrer"&gt;how we handle abuse reports&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  IPv6 doesn't have the problem
&lt;/h2&gt;

&lt;p&gt;IPv6 has so many addresses that nobody needs to share. Every natbox server, including the free trial, gets its own routed &lt;strong&gt;/80&lt;/strong&gt; : 2&lt;sup&gt;48&lt;/sup&gt; addresses, every port open, port 22 and 443 included, no proxy in between (&lt;a href="https://natbox.io/ipv6" rel="noopener noreferrer"&gt;how it works&lt;/a&gt;). As more of the internet speaks IPv6, the shared IPv4 address matters less and less.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who a NAT VPS is for
&lt;/h2&gt;

&lt;p&gt;If you need a full IPv4 address with every port, a NAT VPS isn't the right tool, and that's fine. If you want a real Linux server for a bot, a small website, a VPN, a monitoring tool or for learning, sharing an IPv4 address is what lets it cost less than a coffee. &lt;a href="https://natbox.io/#plans" rel="noopener noreferrer"&gt;See the plans&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get new tutorials in Telegram.&lt;/strong&gt; Follow &lt;a href="https://t.me/natboxio" rel="noopener noreferrer"&gt;@natboxio&lt;/a&gt;: every new post, plus short server tips.&lt;/p&gt;

</description>
      <category>vps</category>
      <category>networking</category>
      <category>ipv4</category>
      <category>hosting</category>
    </item>
    <item>
      <title>Host a Discord bot 24/7 for $1/month (Python + systemd on a NAT VPS)</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Tue, 10 Nov 2026 09:54:59 +0000</pubDate>
      <link>https://dev.to/sarrph/host-a-discord-bot-247-for-1month-python-systemd-on-a-nat-vps-262b</link>
      <guid>https://dev.to/sarrph/host-a-discord-bot-247-for-1month-python-systemd-on-a-nat-vps-262b</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I run &lt;a href="https://natbox.io" rel="noopener noreferrer"&gt;natbox.io&lt;/a&gt;, the host used in this guide. The steps work on any Linux VPS.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A Discord bot doesn't need much. It makes &lt;strong&gt;outgoing&lt;/strong&gt; connections to Discord's gateway and never needs anyone to connect to it. That means it doesn't need its own public IPv4 address, and a typical small bot uses well under 100 MB of RAM.&lt;/p&gt;

&lt;p&gt;So a full $5–6/month VPS is overkill. A small NAT VPS (shared IPv4, a few forwarded ports, your own IPv6) is enough, and that's what we'll use here.&lt;/p&gt;

&lt;p&gt;By the end you'll have a Python bot that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;runs 24/7 as a systemd service&lt;/li&gt;
&lt;li&gt;restarts by itself if it crashes or the server reboots&lt;/li&gt;
&lt;li&gt;keeps its token out of the code&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Discord bot token from the &lt;a href="https://discord.com/developers/applications" rel="noopener noreferrer"&gt;Discord Developer Portal&lt;/a&gt; (New Application → Bot → Reset Token)&lt;/li&gt;
&lt;li&gt;A small Linux server. I'm using a natbox &lt;strong&gt;Nano&lt;/strong&gt; (512 MB RAM, $1/month) running Debian, but any Debian/Ubuntu box works.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Connect over SSH
&lt;/h2&gt;

&lt;p&gt;On a NAT VPS, SSH runs on a forwarded port instead of 22. Your client area shows the exact command, something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh root@your-host -p 40001
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update the system first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt upgrade -y
apt install -y python3 python3-venv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Create a user for the bot
&lt;/h2&gt;

&lt;p&gt;Don't run the bot as root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adduser --system --group --home /opt/mybot bot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Set up Python and the bot code
&lt;/h2&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; /opt/mybot
sudo -u bot python3 -m venv venv
sudo -u bot ./venv/bin/pip install discord.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;/opt/mybot/bot.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;discord&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;discord&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;app_commands&lt;/span&gt;

&lt;span class="n"&gt;intents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;discord&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Intents&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;discord&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;intents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;intents&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;tree&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;app_commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CommandTree&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="nd"&gt;@tree&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ping"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Check that the bot is alive"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ping&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;interaction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;discord&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Interaction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;interaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Pong! {round(client.latency * 1000)} ms"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="nd"&gt;@client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;on_ready&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Logged in as {client.user}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"DISCORD_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It uses a slash command, so it doesn't need the privileged Message Content intent.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Keep the token out of the code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'DISCORD_TOKEN=paste-your-token-here'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /opt/mybot/.env
chown bot:bot /opt/mybot/.env /opt/mybot/bot.py
chmod 600 /opt/mybot/.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Run it as a systemd service
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;/etc/systemd/system/mybot.service&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;My&lt;/span&gt; &lt;span class="nc"&gt;Discord&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;
&lt;span class="na"&gt;After&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;network&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;online&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;
&lt;span class="na"&gt;Wants&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;network&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;online&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;

&lt;span class="k"&gt;[Service]&lt;/span&gt;
&lt;span class="na"&gt;User&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;bot&lt;/span&gt;
&lt;span class="na"&gt;WorkingDirectory&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="n"&gt;opt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mybot&lt;/span&gt;
&lt;span class="na"&gt;EnvironmentFile&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="n"&gt;opt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mybot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;
&lt;span class="na"&gt;ExecStart&lt;/span&gt;&lt;span class="o"&gt;=/&lt;/span&gt;&lt;span class="n"&gt;opt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mybot&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;venv&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt;
&lt;span class="na"&gt;Restart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;always&lt;/span&gt;
&lt;span class="na"&gt;RestartSec&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;

&lt;span class="k"&gt;[Install]&lt;/span&gt;
&lt;span class="na"&gt;WantedBy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;multi&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start it and enable it at boot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl daemon-reload
systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; --now mybot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Check that it works
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl status mybot
journalctl -u mybot -f
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see &lt;code&gt;Logged in as YourBot#1234&lt;/code&gt;. Invite the bot to your server (Developer Portal → OAuth2 → URL Generator, with the &lt;code&gt;bot&lt;/code&gt; and &lt;code&gt;applications.commands&lt;/code&gt; scopes). Type &lt;code&gt;/ping&lt;/code&gt;. New slash commands can take a few minutes to appear.&lt;/p&gt;

&lt;p&gt;To update the bot later, edit &lt;code&gt;bot.py&lt;/code&gt; and run &lt;code&gt;systemctl restart mybot&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How much does it use?
&lt;/h2&gt;

&lt;p&gt;Check with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl status mybot &lt;span class="o"&gt;|&lt;/span&gt; grep Memory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A small discord.py bot like this sits at roughly 50–80 MB, so a 512 MB server has plenty of room, even for a few bots side by side (give each one its own folder and service).&lt;/p&gt;

&lt;h2&gt;
  
  
  When a NAT VPS is &lt;em&gt;not&lt;/em&gt; enough
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If your bot also serves a &lt;strong&gt;web dashboard&lt;/strong&gt;, you need an inbound port. On natbox you can use one of your forwarded ports, or ports 80/443 with your own domain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Music bots&lt;/strong&gt; that stream audio to big servers use more CPU and bandwidth. Pick a bigger plan or a dedicated core.&lt;/li&gt;
&lt;li&gt;If you need a &lt;strong&gt;dedicated IPv4&lt;/strong&gt; for some other reason, get a regular VPS.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;That's it: a bot that runs around the clock for about $12 a year. If you try it on natbox, there's a free 1-month trial (new slots are posted on our Telegram channel), and plans start at $1/month: &lt;a href="https://natbox.io/discord-bot-hosting" rel="noopener noreferrer"&gt;https://natbox.io/discord-bot-hosting&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discord</category>
      <category>python</category>
      <category>linux</category>
      <category>selfhosted</category>
    </item>
    <item>
      <title>We load-tested our shared HTTPS proxy: 15,000 connections, zero drops</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Mon, 09 Nov 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/sarrph/we-load-tested-our-shared-https-proxy-15000-connections-zero-drops-5g40</link>
      <guid>https://dev.to/sarrph/we-load-tested-our-shared-https-proxy-15000-connections-zero-drops-5g40</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqwh4fgcev22108yuknyz.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqwh4fgcev22108yuknyz.png" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On a NAT VPS, ports 80 and 443 of the public IPv4 address are shared by everyone on the node. A reviewer recently asked two fair questions: what happens to a connection the proxy can't place, and how much can the proxy actually take? We checked the first in our config and answered the second with a load test. Here is what we did and what we found, including the parts that weren't perfect.&lt;/p&gt;

&lt;h2&gt;
  
  
  How HTTPS reaches your server
&lt;/h2&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faa5wnails6cfyfw7gt6w.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faa5wnails6cfyfw7gt6w.png" alt="A visitor connects to the shared IPv4 address on port 443. HAProxy reads only the domain name (SNI) and passes the encrypted connection to the customer's server. No name or an unknown name is refused." width="800" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each node runs HAProxy in TCP mode. It reads one thing from the start of the TLS handshake, the domain name the browser asks for (SNI), looks it up in the list of domains our customers have linked and verified, and passes the still-encrypted connection to that customer's server. We never terminate TLS or hold your certificate.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It fails closed.&lt;/strong&gt; The lookup is an exact match. If no name is sent, or the name isn't linked to a natbox server, the connection is refused. There is no default backend, so a connection can never land on someone else's server. We confirmed this live during the test.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fair use per visitor.&lt;/strong&gt; One source address can open up to 200 new connections in any 10 seconds and keep up to 100 open at once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Over IPv6 there is no proxy at all:&lt;/strong&gt; every server has its own routed /80, so visitors reach it directly. That is also where HTTP/3 works, because UDP 443 isn't forwarded on the shared IPv4. Details are in our &lt;a href="https://natbox.io/docs#routing" rel="noopener noreferrer"&gt;docs&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How we tested
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One production node: 18 vCPU, HAProxy 2.8 with 18 threads, a configured maximum of 20,000 connections. We picked it because no customer domain was linked there yet, so no customer HTTPS traffic went through the proxy we were stressing.&lt;/li&gt;
&lt;li&gt;A temporary test server on the same node ran nginx with a self-signed certificate and was capped at 4 CPU cores. We added its test domain to the proxy in memory only and removed it afterwards.&lt;/li&gt;
&lt;li&gt;The load generator ran on the node itself and spread its connections over 250 local source addresses, so the per-visitor limits above weren't what we measured.&lt;/li&gt;
&lt;li&gt;A separate probe opened one real connection every second throughout, to see what an ordinary visitor would have experienced.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmy4vsjg59cwwvui8hw9t.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmy4vsjg59cwwvui8hw9t.png" alt="Results table: 548 to 650 full TLS handshakes per second at 100 to 1,000 concurrent clients with zero errors; 5,000 and 15,000 long-lived connections all survived 60 seconds with every keep-alive request answered; proxy memory 47 and 85 MB." width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;New connections.&lt;/strong&gt; Each one was a full TLS handshake, one HTTP request and a close, with no session reuse. With 100, 400 and 1,000 clients at once we got &lt;strong&gt;548, 558 and 650 handshakes a second&lt;/strong&gt; , over 53,000 in total, with &lt;strong&gt;zero errors&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Long-lived connections.&lt;/strong&gt; We opened 5,000 and then 15,000 TLS connections, kept them for a minute and sent a request on every one of them every 20 seconds. &lt;strong&gt;All 15,000 stayed up and all 45,000 requests were answered.&lt;/strong&gt; The proxy used 85 MB of memory for them, about 5 KB per connection, and under 2 CPU cores.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the numbers mean, and what they don't
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The handshake figure is not the proxy's limit.&lt;/strong&gt; In passthrough mode the expensive part of TLS happens on the server behind the proxy. Ours had 4 cores and became the bottleneck, together with the load generator. HAProxy itself used about 3 of its 18 cores at the busiest point.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The real ceiling is the connection limit:&lt;/strong&gt; 20,000 open connections per node, which we set ourselves. 15,000 held without trouble.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It wasn't free.&lt;/strong&gt; During the heaviest 30-second step the node's load briefly rose well above its core count, almost all of it from our test client and test server rather than the proxy. Our probe's handshake time went from its usual 15 to 20 ms to as much as 1 second at that moment, and to 2.7 seconds once while we opened 15,000 connections within 20 seconds. That's why we kept each step short, and why we'd run a test like this again only at a quiet hour.&lt;/li&gt;
&lt;li&gt;This is one node and one short test, not a lab benchmark. Real traffic is spread over many visitors and many customer servers, which is easier on the proxy than one test server taking everything.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this means for your server
&lt;/h2&gt;

&lt;p&gt;If you host a website on natbox, the shared proxy is very unlikely to be what slows you down. Your own server, with its share of CPU, will run out of TLS handshakes long before the proxy does. If you want to skip the proxy completely, add an AAAA record: IPv6 visitors then connect straight to your server, with HTTP/3 if you enable it. You link a domain in the client area (&lt;a href="https://natbox.io/guides/host-a-website" rel="noopener noreferrer"&gt;guide&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;We'll keep publishing numbers like these as natbox grows. If you'd like to see a test we haven't run, tell us at &lt;a href="mailto:support@natbox.io"&gt;support@natbox.io&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get new tutorials in Telegram.&lt;/strong&gt; Follow &lt;a href="https://t.me/natboxio" rel="noopener noreferrer"&gt;@natboxio&lt;/a&gt;: every new post, plus short server tips.&lt;/p&gt;

</description>
      <category>networking</category>
      <category>performance</category>
      <category>devops</category>
      <category>https</category>
    </item>
    <item>
      <title>Open a private admin page with an SSH tunnel, no open port needed</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Mon, 09 Nov 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/sarrph/open-a-private-admin-page-with-an-ssh-tunnel-no-open-port-needed-1ba7</link>
      <guid>https://dev.to/sarrph/open-a-private-admin-page-with-an-ssh-tunnel-no-open-port-needed-1ba7</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fquhkk4bzhab4pvdlu9bo.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fquhkk4bzhab4pvdlu9bo.png" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Many server apps come with a web page for setup or admin: dashboards, database tools, code editors. Putting those pages on the open internet invites password guessing, and on a NAT VPS every open port is one of your few forwarded ports. An &lt;strong&gt;SSH tunnel&lt;/strong&gt; gives you a third option: the page stays private on the server, and only you reach it, through the SSH connection you already use.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqh79x6wjxjehtpmyts2z.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqh79x6wjxjehtpmyts2z.png" alt="Diagram: your browser opens localhost:8080, an encrypted SSH tunnel carries it through your SSH port to the admin page on 127.0.0.1:3001 on your server" width="800" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Make the app listen only on the server itself
&lt;/h2&gt;

&lt;p&gt;Set your app to listen on &lt;code&gt;127.0.0.1&lt;/code&gt; (also called localhost) instead of &lt;code&gt;0.0.0.0&lt;/code&gt;. The setting is usually called &lt;em&gt;host&lt;/em&gt;, &lt;em&gt;bind&lt;/em&gt; or &lt;em&gt;listen address&lt;/em&gt;. Then nothing outside the server can reach it. Check with &lt;code&gt;ss&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx4p7lpq4o3bzk6hzf0jl.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx4p7lpq4o3bzk6hzf0jl.png" alt="ss shows SSH listening on all addresses and the admin app only on 127.0.0.1 port 3001" width="798" height="258"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;SSH on port 22 is reachable; the app on 3001 is only reachable from the server itself.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Open the tunnel from your computer
&lt;/h2&gt;

&lt;p&gt;On your own computer (Linux, macOS, or Windows 10 and 11 in PowerShell, which include &lt;code&gt;ssh&lt;/code&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;ssh &lt;span class="nt"&gt;-N&lt;/span&gt; &lt;span class="nt"&gt;-L&lt;/span&gt; 8080:localhost:3001 root@natbox.io &lt;span class="nt"&gt;-p&lt;/span&gt; YOUR_SSH_PORT
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-L 8080:localhost:3001&lt;/code&gt;: connections to port 8080 on &lt;em&gt;your computer&lt;/em&gt; go to port 3001 on &lt;em&gt;the server&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-N&lt;/code&gt;: just the tunnel, no shell. Leave the window open while you work; press Ctrl+C to close it.&lt;/li&gt;
&lt;li&gt;Use your own SSH port from the client area, the same one you log in with.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw79fuyghlkylcpgh411j.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw79fuyghlkylcpgh411j.png" alt="On the laptop: the ssh -L command, then curl to localhost:8080 returns the page from the server" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Open it in your browser
&lt;/h2&gt;

&lt;p&gt;Go to &lt;code&gt;http://localhost:8080&lt;/code&gt;. You are looking at the page on your server, carried over the encrypted SSH connection. In our test it is a small private log browser that only listens on 127.0.0.1:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbbacg35v81b8enjx2mtr.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbbacg35v81b8enjx2mtr.png" alt="A browser showing the server's private page at http://localhost:8080" width="799" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Several pages at once:&lt;/strong&gt; add more &lt;code&gt;-L&lt;/code&gt; options, for example &lt;code&gt;-L 8080:localhost:3001 -L 8081:localhost:8443&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Save typing:&lt;/strong&gt; put it in &lt;code&gt;~/.ssh/config&lt;/code&gt; on your computer, then run &lt;code&gt;ssh -N mybox&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="k"&gt;Host&lt;/span&gt; mybox
    &lt;span class="k"&gt;HostName&lt;/span&gt; natbox.io
    &lt;span class="k"&gt;Port&lt;/span&gt; YOUR_SSH_PORT
    &lt;span class="k"&gt;User&lt;/span&gt; root
    &lt;span class="k"&gt;LocalForward&lt;/span&gt; &lt;span class="m"&gt;8080&lt;/span&gt; localhost:3001
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"Address already in use":&lt;/strong&gt; something on your computer already uses 8080. Pick another local number, such as 8090.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Over IPv6:&lt;/strong&gt; you can also connect to your server's IPv6 address on port 22, if your network has IPv6.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good candidates: the admin page of &lt;a href="https://natbox.io/guides/uptime-kuma" rel="noopener noreferrer"&gt;Uptime Kuma&lt;/a&gt;, a database tool for &lt;a href="https://natbox.io/guides/postgresql" rel="noopener noreferrer"&gt;PostgreSQL&lt;/a&gt;, or any app you only use yourself. For a public website, use a proper reverse proxy with HTTPS instead: see &lt;a href="https://natbox.io/guides/caddy-https" rel="noopener noreferrer"&gt;HTTPS with Caddy&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get new tutorials in Telegram.&lt;/strong&gt; Follow &lt;a href="https://t.me/natboxio" rel="noopener noreferrer"&gt;@natboxio&lt;/a&gt;: every new post, plus short server tips.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>ssh</category>
      <category>devops</category>
      <category>selfhosted</category>
    </item>
    <item>
      <title>Disk full? Find what is filling your server, and clean it up safely</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Sat, 07 Nov 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/sarrph/disk-full-find-what-is-filling-your-server-and-clean-it-up-safely-4fil</link>
      <guid>https://dev.to/sarrph/disk-full-find-what-is-filling-your-server-and-clean-it-up-safely-4fil</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzbrrq1rupf6ef8xde51f.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzbrrq1rupf6ef8xde51f.png" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a disk fills up, apps start failing in odd ways: databases stop writing, updates break halfway, and logins can get slow. Small servers fill up faster, so it pays to know where the space goes. Here is how to find out in a few minutes, and what is safe to delete.&lt;/p&gt;

&lt;p&gt;About 10 minutes. Debian and Ubuntu commands; the checks work the same on AlmaLinux and Alpine.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. How full is the disk?
&lt;/h2&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcalr4hb62vnbrwgekdy1.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcalr4hb62vnbrwgekdy1.png" alt="df -h shows a 5.2 GB disk with 1.9 GB used, 37 percent" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;df -h /&lt;/code&gt; shows the size of your disk, how much is used and how much is left. On your server the first column shows your own server's name. The &lt;strong&gt;Graphs&lt;/strong&gt; tab in the client area shows the same number. Above about 85% it is time to clean up.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Which folders are big?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;du&lt;/code&gt; adds up folder sizes. Start at the top and work down into the biggest folder:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj5rhumnhn5sha0xwqenx.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj5rhumnhn5sha0xwqenx.png" alt="du shows /root at 901 MB and /var at 722 MB; inside /var, /var/log is 641 MB" width="800" height="396"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The -x keeps du on your disk, and sort -h puts the biggest last.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Or browse it with ncdu
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;ncdu&lt;/code&gt; does the same thing with a menu you can move around in with the arrow keys and Enter. Press d on a file to delete it (it asks first) and q to quit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; ncdu
ncdu &lt;span class="nt"&gt;-x&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl3brrkkqlaqwzrt14t7n.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl3brrkkqlaqwzrt14t7n.png" alt="ncdu showing /root as the biggest folder at 900 MB" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. List the biggest files
&lt;/h2&gt;

&lt;p&gt;Usually a few large files are to blame. This lists every file over 100 MB:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr311mdcjbvps7ycn21qt.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr311mdcjbvps7ycn21qt.png" alt="find lists a 900 MB old backup archive and a 640 MB log file" width="798" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here it is an old backup someone forgot about, and an app log that was never rotated.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Clean up safely
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Package cache:&lt;/strong&gt; &lt;code&gt;apt-get clean&lt;/code&gt; removes downloaded package files. Always safe.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Old kernels and packages:&lt;/strong&gt; &lt;code&gt;apt autoremove&lt;/code&gt; removes packages nothing needs any more. Read the list before you say yes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The system journal:&lt;/strong&gt; &lt;code&gt;journalctl --vacuum-size=50M&lt;/code&gt; keeps only the newest 50 MB of logs. See &lt;code&gt;journalctl --disk-usage&lt;/code&gt; first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A huge log file an app still writes to:&lt;/strong&gt; empty it with &lt;code&gt;truncate -s 0 FILE&lt;/code&gt; rather than deleting it. If you delete a file a running program has open, the space is only freed when that program restarts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Old backups:&lt;/strong&gt; copy them off the server first (see &lt;a href="https://natbox.io/guides/backups" rel="noopener noreferrer"&gt;the backups guide&lt;/a&gt;), then delete them.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4r5f95bobc07ljd5dot2.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4r5f95bobc07ljd5dot2.png" alt="After cleaning: 371 MB used, 7 percent" width="799" height="276"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From 37% to 7% used.&lt;/p&gt;

&lt;h2&gt;
  
  
  Snapshots use disk space too
&lt;/h2&gt;

&lt;p&gt;Snapshots you take in the client area's &lt;strong&gt;Snapshots&lt;/strong&gt; tab are stored on your server's disk, so a snapshot keeps the files it saved, even after you delete them. If space is tight, delete snapshots you no longer need. More in the &lt;a href="https://natbox.io/docs" rel="noopener noreferrer"&gt;docs&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stop it happening again
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make your app logs rotate: add a file in &lt;code&gt;/etc/logrotate.d/&lt;/code&gt;, or log to the journal by running the app as a service (&lt;a href="https://natbox.io/guides/run-an-app" rel="noopener noreferrer"&gt;how&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Cap the journal for good: set &lt;code&gt;SystemMaxUse=100M&lt;/code&gt; in &lt;code&gt;/etc/systemd/journald.conf&lt;/code&gt;, then &lt;code&gt;systemctl restart systemd-journald&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Keep backups off the server, not next to the data they protect.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Still short of space? You can move to a bigger plan from the client area at any time. See &lt;a href="https://natbox.io/#plans" rel="noopener noreferrer"&gt;the plans&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get new tutorials in Telegram.&lt;/strong&gt; Follow &lt;a href="https://t.me/natboxio" rel="noopener noreferrer"&gt;@natboxio&lt;/a&gt;: every new post, plus short server tips.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>sysadmin</category>
      <category>selfhosted</category>
    </item>
    <item>
      <title>Keep commands running after you disconnect, with tmux</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Thu, 05 Nov 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/sarrph/keep-commands-running-after-you-disconnect-with-tmux-18hp</link>
      <guid>https://dev.to/sarrph/keep-commands-running-after-you-disconnect-with-tmux-18hp</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3i6s9ejdvesbpe7ve4ik.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3i6s9ejdvesbpe7ve4ik.png" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You start a big download or a backup over SSH, your Wi-Fi drops, and the command dies with your connection. &lt;strong&gt;tmux&lt;/strong&gt; fixes that: it keeps a terminal running on the server, so you can disconnect, go home, and pick it up again later exactly where it was.&lt;/p&gt;

&lt;p&gt;About 5 minutes. Works on any natbox plan. Commands for Debian and Ubuntu; on AlmaLinux use &lt;code&gt;dnf install -y tmux&lt;/code&gt;, on Alpine &lt;code&gt;apk add tmux&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Install tmux and start a session
&lt;/h2&gt;

&lt;p&gt;Log in to your server (&lt;code&gt;ssh root@natbox.io -p YOUR_PORT&lt;/code&gt;), install tmux and start a session with a name you will remember:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; tmux
tmux new &lt;span class="nt"&gt;-s&lt;/span&gt; download
&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhycsj5uir38jlgg96wzc.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhycsj5uir38jlgg96wzc.png" alt="Installing tmux and starting a session called download" width="799" height="162"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Run your long command inside it
&lt;/h2&gt;

&lt;p&gt;You are now inside tmux: it looks like a normal terminal, with a green bar at the bottom showing the session name. Start anything that takes a while. Here we download a 756 MB Debian image:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F90wpafbsz2mfygr7q81l.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F90wpafbsz2mfygr7q81l.png" alt="A curl download running inside a tmux session called download, with the green tmux status bar at the bottom" width="800" height="239"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The green bar shows you are inside tmux: session download, window 0.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Detach, and log out if you like
&lt;/h2&gt;

&lt;p&gt;Press Ctrl+B, let go, then press D. You are back in your normal shell, and tmux tells you the session is still alive. &lt;code&gt;tmux ls&lt;/code&gt; lists your sessions. You can now close the window, log out, or lose your connection: the command keeps running on the server.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn7zan2p8stpbovlfi5me.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn7zan2p8stpbovlfi5me.png" alt="Detaching from tmux and listing sessions with tmux ls" width="800" height="258"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  4. Come back to it
&lt;/h2&gt;

&lt;p&gt;Log in again, from any computer, and reattach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tmux attach &lt;span class="nt"&gt;-t&lt;/span&gt; download
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything is where you left it. Our download had kept going and was at 94%:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftpalbd6l86avzkunnzba.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftpalbd6l86avzkunnzba.png" alt="After reattaching, the download is at 94 percent" width="800" height="239"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When the command has finished, type &lt;code&gt;exit&lt;/code&gt; to close the session.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Bonus: two panes side by side
&lt;/h2&gt;

&lt;p&gt;Inside tmux, Ctrl+B then % splits the window in two. Here the left pane follows an app's log with &lt;code&gt;journalctl -fu myapp&lt;/code&gt; while the right pane checks memory and disk. Ctrl+B then an arrow key moves between panes.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm0lljgbjo2okjg8msq6d.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm0lljgbjo2okjg8msq6d.png" alt="A tmux window split into two panes: an app log on the left, memory and disk checks on the right" width="799" height="244"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The keys you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;tmux new -s NAME&lt;/code&gt;: start a session. &lt;code&gt;tmux ls&lt;/code&gt;: list sessions. &lt;code&gt;tmux attach -t NAME&lt;/code&gt;: go back in.&lt;/li&gt;
&lt;li&gt;
Ctrl+B then D: detach. Ctrl+B then % or ": split side by side or top and bottom.&lt;/li&gt;
&lt;li&gt;
Ctrl+B then [: scroll back with the arrow keys or Page Up; Q to stop scrolling.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  tmux or a service?
&lt;/h2&gt;

&lt;p&gt;tmux is for jobs you start by hand and want to watch: downloads, backups, updates, a game server console. Anything that should run all the time and start again after a reboot, such as a bot or a website, belongs in a systemd service instead: see &lt;a href="https://natbox.io/guides/run-an-app" rel="noopener noreferrer"&gt;Keep an app running&lt;/a&gt;. A tmux session does not survive a server restart.&lt;/p&gt;

&lt;p&gt;No server yet? &lt;a href="https://natbox.io/free-vps-trial" rel="noopener noreferrer"&gt;Try one free for a month&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get new tutorials in Telegram.&lt;/strong&gt; Follow &lt;a href="https://t.me/natboxio" rel="noopener noreferrer"&gt;@natboxio&lt;/a&gt;: every new post, plus short server tips.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>tmux</category>
      <category>ssh</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Welcome to the natbox blog, and our new video library</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Wed, 04 Nov 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/sarrph/welcome-to-the-natbox-blog-and-our-new-video-library-3fg7</link>
      <guid>https://dev.to/sarrph/welcome-to-the-natbox-blog-and-our-new-video-library-3fg7</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3c6jx6c9rz0yc3r6g6yg.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3c6jx6c9rz0yc3r6g6yg.png" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;natbox runs small Linux servers with root over SSH, your own block of IPv4 ports and a routed /80 of IPv6, from $1.00 a month. This blog is where we will post step-by-step tutorials, longer guides, and news when something changes on our side.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you will find here
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tutorials:&lt;/strong&gt; one task from start to finish, with every command, written for a natbox server but useful on any Linux VPS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guides:&lt;/strong&gt; the background to the tutorials, such as how NAT ports and IPv6 work, and how to choose a plan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Announcements and updates:&lt;/strong&gt; new features, changes to plans, and anything that affects your server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our reference guides stay in &lt;a href="https://natbox.io/guides" rel="noopener noreferrer"&gt;Guides&lt;/a&gt;, and the basics of your account are in the &lt;a href="https://natbox.io/docs" rel="noopener noreferrer"&gt;docs&lt;/a&gt;. Blog posts link to them rather than repeat them.&lt;/p&gt;

&lt;h2&gt;
  
  
  New: videos
&lt;/h2&gt;

&lt;p&gt;We have also put all our videos on one page: &lt;a href="https://natbox.io/video" rel="noopener noreferrer"&gt;natbox.io/video&lt;/a&gt;. They play from our own server, with no YouTube embed and no cookies, and the longer ones have English captions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://natbox.io/video#first-server" rel="noopener noreferrer"&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7bxkaep9e2w0tbdx241q.png" alt="Video thumbnail: Free Linux server plus SSH in 2 minutes" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Our first-server tutorial. Watch it on the video page.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://natbox.io/video#first-server" rel="noopener noreferrer"&gt;Get a free server and log in over SSH&lt;/a&gt; (2:10): start a free trial, log in, change your password, and see how your ports and IPv6 work.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://natbox.io/video#discord-bot" rel="noopener noreferrer"&gt;Host a Discord bot 24/7&lt;/a&gt; (1:39): install a bot, keep its token safe, and run it as a systemd service that restarts by itself.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://natbox.io/video#shorts" rel="noopener noreferrer"&gt;Three Shorts&lt;/a&gt; of under 35 seconds, including &lt;a href="https://natbox.io/nat-vps" rel="noopener noreferrer"&gt;what a NAT VPS is&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Follow along
&lt;/h2&gt;

&lt;p&gt;Add &lt;a href="https://natbox.io/blog/feed.xml" rel="noopener noreferrer"&gt;natbox.io/blog/feed.xml&lt;/a&gt; to your feed reader, or follow us on &lt;a href="https://x.com/natboxio" rel="noopener noreferrer"&gt;X&lt;/a&gt; and &lt;a href="https://www.youtube.com/@natboxio" rel="noopener noreferrer"&gt;YouTube&lt;/a&gt;. If there is a tutorial you would like to see, &lt;a href="https://my.natbox.io/tickets/create" rel="noopener noreferrer"&gt;open a ticket&lt;/a&gt; or email &lt;a href="mailto:support@natbox.io"&gt;support@natbox.io&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;New to natbox? &lt;a href="https://natbox.io/free-vps-trial" rel="noopener noreferrer"&gt;Try a server free for a month&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>announcement</category>
    </item>
    <item>
      <title>What's new at natbox: Telegram bot, snapshots, keeping your trial and CaptchaBox</title>
      <dc:creator>Mohammad Alsaraf</dc:creator>
      <pubDate>Wed, 04 Nov 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/sarrph/whats-new-at-natbox-telegram-bot-snapshots-keeping-your-trial-and-captchabox-2j3i</link>
      <guid>https://dev.to/sarrph/whats-new-at-natbox-telegram-bot-snapshots-keeping-your-trial-and-captchabox-2j3i</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqu2asjgcb93hdobd5eun.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqu2asjgcb93hdobd5eun.png" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A lot has changed in the client area over the last few days. Here is everything new, and where to find it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Manage your servers from Telegram
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://t.me/NatboxBot" rel="noopener noreferrer"&gt;@NatboxBot&lt;/a&gt; lets you check and control your servers from Telegram. Link it from the &lt;a href="https://my.natbox.io/telegram" rel="noopener noreferrer"&gt;Telegram page&lt;/a&gt; in the client area (account menu, then &lt;strong&gt;Telegram&lt;/strong&gt; ). After that you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;see each server's status, SSH command, ports, IPv6 address, traffic and paid-until date;&lt;/li&gt;
&lt;li&gt;start, stop and restart a server (stop and restart ask you first);&lt;/li&gt;
&lt;li&gt;pay an unpaid invoice from your account credit, or open it on the website to pay another way;&lt;/li&gt;
&lt;li&gt;get notices for new invoices, payments, support replies, and when a server is set up or a trial is about to end.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://t.me/NatboxBot" rel="noopener noreferrer"&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4a62hfdsptaopd1l89fj.png" alt="@NatboxBot in Telegram: server status, SSH command, traffic, and Restart and Stop buttons" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The bot also has a small app (the &lt;strong&gt;Open app&lt;/strong&gt; button) with the same features. You can even create an account in the bot. For safety the bot never shows passwords and cannot reinstall a server, and there are no payments inside Telegram.&lt;/p&gt;

&lt;h2&gt;
  
  
  Snapshots you control
&lt;/h2&gt;

&lt;p&gt;The new &lt;strong&gt;Snapshots&lt;/strong&gt; tab on each server saves the server exactly as it is, for example before a big update, and lets you go back to it later. You can keep 1 snapshot on the free trial and the VPN plan, 2 on Nano, 3 on Box and Box CPU, and 5 on Box Plus. Snapshots use your server's disk space and are stored on the same machine, so keep your own off-site backups as well. The &lt;a href="https://natbox.io/guides/backups" rel="noopener noreferrer"&gt;backups guide&lt;/a&gt; shows how.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep your free trial server
&lt;/h2&gt;

&lt;p&gt;If you like your free trial, you no longer need to start again on a new server. Open the trial in the client area and choose a paid plan to keep it, with all your files and settings. We also email you 7 days and 2 days before a trial ends, so it never ends by surprise.&lt;/p&gt;

&lt;h2&gt;
  
  
  PayPal from $1
&lt;/h2&gt;

&lt;p&gt;You can now pay with PayPal from $1, so a single month of Nano or Box can be paid directly. Crypto payments start at $3, and account credit works for any amount. The VPN plan and burner servers have their own payment options, listed in the &lt;a href="https://natbox.io/docs" rel="noopener noreferrer"&gt;docs&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  CaptchaBox: a free captcha for your own sites
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://captcha.natbox.io/" rel="noopener noreferrer"&gt;CaptchaBox&lt;/a&gt; keeps bots out of your website's forms without image puzzles, cookies or Google. Visitors' browsers solve a small puzzle in the background, and your server checks the answer. It is free for 10,000 checks a month, and switching from reCAPTCHA is easy because the server check uses the same answer format. We use it on our own sign-in and sign-up pages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://captcha.natbox.io/" rel="noopener noreferrer"&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsrt7xm549130zbp7nb5u.png" alt="CaptchaBox: a free captcha with no puzzles and no cookies" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Watch CaptchaBox in one minute on captcha.natbox.io.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;Follow this blog for tutorials and news, or subscribe with the &lt;a href="https://natbox.io/blog/feed.xml" rel="noopener noreferrer"&gt;RSS feed&lt;/a&gt;. You can also watch our &lt;a href="https://natbox.io/video" rel="noopener noreferrer"&gt;videos&lt;/a&gt;. Questions or ideas: &lt;a href="https://my.natbox.io/tickets/create" rel="noopener noreferrer"&gt;open a ticket&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>update</category>
    </item>
  </channel>
</rss>
