<?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: Sovrab Roy</title>
    <description>The latest articles on DEV Community by Sovrab Roy (@sovrab).</description>
    <link>https://dev.to/sovrab</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%2F3916743%2F1bd6fb46-6cc5-46a1-9687-f73cde40dfce.png</url>
      <title>DEV Community: Sovrab Roy</title>
      <link>https://dev.to/sovrab</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sovrab"/>
    <language>en</language>
    <item>
      <title>When DNS Lies: TTL, Propagation, Resolver Caching and Debugging with dig</title>
      <dc:creator>Sovrab Roy</dc:creator>
      <pubDate>Sat, 05 Dec 2026 23:25:22 +0000</pubDate>
      <link>https://dev.to/sovrab/when-dns-lies-ttl-propagation-resolver-caching-and-debugging-with-dig-330e</link>
      <guid>https://dev.to/sovrab/when-dns-lies-ttl-propagation-resolver-caching-and-debugging-with-dig-330e</guid>
      <description>&lt;h1&gt;
  
  
  When DNS Lies: TTL, Propagation, Resolver Caching and Debugging with dig
&lt;/h1&gt;

&lt;p&gt;Your website is down. Except it is not down. It loads fine on your phone, fails on your laptop, and your client in another country sees a completely different error. You check the server. The server is fine.&lt;/p&gt;

&lt;p&gt;This is almost always DNS. And the worst part is that DNS lies to you while you debug it, because every layer between you and the authoritative nameserver keeps its own copy of the truth, each with its own expiry timer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The lie: "DNS hasn't propagated yet"
&lt;/h2&gt;

&lt;p&gt;Propagation is real, but it is rarely the actual problem. When you change a DNS record, the authoritative nameserver has the new value immediately. What you are waiting for is not propagation. It is caches expiring.&lt;/p&gt;

&lt;p&gt;The chain looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your browser -&amp;gt; OS stub resolver -&amp;gt; recursive resolver (ISP / 1.1.1.1 / 8.8.8.8)
  -&amp;gt; authoritative nameserver -&amp;gt; the real record
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every step in that chain can serve a stale answer until the record's TTL (time to live) expires. A record with a TTL of 86400 seconds can look "not propagated" for a full day, even though nothing is broken.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start at the source: query the authoritative server
&lt;/h2&gt;

&lt;p&gt;When something looks wrong, never start with your local resolver. Start with the server that owns the zone:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig @ns1.yourprovider.com example.com +short
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the authoritative answer is correct, your DNS change is live. Everything after that is caching.&lt;/p&gt;

&lt;p&gt;Compare it against public resolvers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig @1.1.1.1 example.com +short
dig @8.8.8.8 example.com +short
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If Cloudflare and Google disagree, one of them is still holding the old record. Wait out the TTL. Do not "fix" it by changing the record again, you will only reset the confusion.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read the TTL, not just the answer
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig example.com +noall +answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;example.com.  300  IN  A  203.0.113.10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That &lt;code&gt;300&lt;/code&gt; is the remaining TTL in seconds. If it says 300, the answer expires in 5 minutes. If it says 86300, someone cached it for a day and you are waiting until tomorrow. The TTL in the answer tells you exactly how long the lie will last.&lt;/p&gt;

&lt;p&gt;Trace the full path when you suspect a delegation problem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig example.com +trace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows every hop from the root servers down to your authoritative nameserver. A wrong NS record at the registrar or a stale delegation shows up here immediately.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four caches that betray you
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Negative caching.&lt;/strong&gt; A failed lookup is also cached. If you queried a record before it existed, the NXDOMAIN answer can be cached for minutes or hours, and the correct record will keep failing until that negative TTL expires. Check it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig nonexistent.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see &lt;code&gt;status: NXDOMAIN&lt;/code&gt; with a TTL in the AUTHORITY SECTION, that failure is cached. There is nothing to fix on the server side. Wait it out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The OS resolver cache.&lt;/strong&gt; On modern Ubuntu, systemd-resolved caches answers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;resolvectl flush-caches
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On older systems:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo systemd-resolve --flush-caches
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. The browser cache.&lt;/strong&gt; Chrome and Firefox cache DNS independently of the OS. In Chrome, open &lt;code&gt;chrome://net-internals/#dns&lt;/code&gt; and clear the host cache. Otherwise you can flush everything on the machine and the browser will still show the old site.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. /etc/hosts.&lt;/strong&gt; The oldest trap in the book. A forgotten entry in &lt;code&gt;/etc/hosts&lt;/code&gt; overrides DNS completely, and &lt;code&gt;dig&lt;/code&gt; will not show it because dig queries DNS directly, bypassing the hosts file. When dig says one thing and the browser says another, check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep example.com /etc/hosts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A debugging workflow that actually works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Query the authoritative server first. If it is wrong, fix the zone and stop.&lt;/li&gt;
&lt;li&gt;Query two public resolvers. If they disagree, it is caching. Read the remaining TTL.&lt;/li&gt;
&lt;li&gt;Check the record type you actually changed. A missing &lt;code&gt;www&lt;/code&gt; A record is not a propagation problem, it is a missing record.&lt;/li&gt;
&lt;li&gt;Check MX and TXT separately when mail breaks. Web working does not mean mail works:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig example.com MX +short
dig example.com TXT +short
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Flush the local caches, then the browser cache, then test again.&lt;/li&gt;
&lt;li&gt;Check &lt;code&gt;/etc/hosts&lt;/code&gt; before you blame the network.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The one habit that prevents all of this
&lt;/h2&gt;

&lt;p&gt;Before any migration, lower the TTL 24 to 48 hours in advance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;example.com.  300  IN  A  203.0.113.10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A 300 second TTL means a bad change is reversible in five minutes, and a good change is visible everywhere in five minutes. The default TTL of 86400 is the reason a typo can ruin your whole day.&lt;/p&gt;

&lt;p&gt;DNS does not lie on purpose. It just remembers the past for exactly as long as you told it to. The TTL is the contract. Read it before you panic.&lt;/p&gt;

&lt;p&gt;What is the strangest DNS issue you have debugged? I read every comment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/sovrab/mastering-netstat-the-linux-command-that-separates-beginners-from-real-infrastructure-engineers-2kn7"&gt;Mastering Netstat: The Linux Command That Separates Beginners from Real Infrastructure Engineers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/sovrab/your-server-has-open-doors-you-dont-know-about-535f"&gt;Your server has open doors you don't know about.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;About the author:&lt;/strong&gt; Sovrab Roy is a Linux System Administrator &amp;amp; Server Engineer with 6+ years of experience managing 50+ production servers at 99.9% uptime. He works with WHM/cPanel, VPS, Docker, networking and server security. More of his field notes: &lt;a href="https://dev.to/sovrab"&gt;dev.to/sovrab&lt;/a&gt; · &lt;a href="https://sovrabroy.online" rel="noopener noreferrer"&gt;sovrabroy.online&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>networking</category>
      <category>devops</category>
      <category>dns</category>
    </item>
    <item>
      <title>Mastering Netstat: The Linux Command That Separates Beginners from Real Infrastructure Engineers</title>
      <dc:creator>Sovrab Roy</dc:creator>
      <pubDate>Tue, 09 Jun 2026 20:04:30 +0000</pubDate>
      <link>https://dev.to/sovrab/mastering-netstat-the-linux-command-that-separates-beginners-from-real-infrastructure-engineers-2kn7</link>
      <guid>https://dev.to/sovrab/mastering-netstat-the-linux-command-that-separates-beginners-from-real-infrastructure-engineers-2kn7</guid>
      <description>&lt;p&gt;In the era of Kubernetes, cloud-native architectures, and microservices, many engineers focus on high-level abstractions. But when a production server starts behaving unexpectedly, a service fails to bind to a port, or suspicious network activity appears, experienced engineers often turn to one of the most fundamental networking tools available:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;netstat&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Despite being considered a legacy utility on some modern Linux distributions, netstat remains one of the most valuable commands for understanding what's happening on a system in real time.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Netstat Still Matters
&lt;/h2&gt;

&lt;p&gt;Tools come and go, but networking fundamentals remain unchanged.&lt;/p&gt;

&lt;p&gt;Whether you're a:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linux Administrator&lt;/li&gt;
&lt;li&gt;DevOps Engineer&lt;/li&gt;
&lt;li&gt;Site Reliability Engineer (SRE)&lt;/li&gt;
&lt;li&gt;Security Analyst&lt;/li&gt;
&lt;li&gt;Cloud Engineer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding network connections at the operating system level is a critical skill.&lt;/p&gt;

&lt;p&gt;Netstat provides visibility into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Active network connections&lt;/li&gt;
&lt;li&gt;Listening ports&lt;/li&gt;
&lt;li&gt;Routing tables&lt;/li&gt;
&lt;li&gt;Network interface statistics&lt;/li&gt;
&lt;li&gt;Protocol-level activity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When applications fail, netstat often reveals the root cause within seconds.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Viewing All Active Connections
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;This command displays:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TCP connections&lt;/li&gt;
&lt;li&gt;UDP connections&lt;/li&gt;
&lt;li&gt;Listening sockets&lt;/li&gt;
&lt;li&gt;Established sessions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Proto Recv-Q Send-Q Local Address       Foreign Address      State
tcp        0      0 0.0.0.0:22          0.0.0.0:*            LISTEN
tcp        0      0 server:443          client:51234         ESTABLISHED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This immediately tells you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which services are listening&lt;/li&gt;
&lt;li&gt;Which clients are connected&lt;/li&gt;
&lt;li&gt;The current state of each connection&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Finding Open Listening Ports
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;Every open port represents an exposed service.&lt;/p&gt;

&lt;p&gt;During infrastructure audits, this command helps answer a critical question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What services are actually reachable from the network?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Many security incidents start with forgotten services listening on unexpected ports.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Displaying TCP Listening Services
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tcp   0   0 0.0.0.0:22    0.0.0.0:*   LISTEN
tcp   0   0 0.0.0.0:80    0.0.0.0:*   LISTEN
tcp   0   0 0.0.0.0:443   0.0.0.0:*   LISTEN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From a quick glance, you can identify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSH&lt;/li&gt;
&lt;li&gt;HTTP&lt;/li&gt;
&lt;li&gt;HTTPS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;running on the server.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Viewing UDP Services
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;Unlike TCP, UDP does not establish persistent connections.&lt;/p&gt;

&lt;p&gt;This command is useful for identifying services such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DNS&lt;/li&gt;
&lt;li&gt;DHCP&lt;/li&gt;
&lt;li&gt;NTP&lt;/li&gt;
&lt;li&gt;Syslog&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding UDP listeners is essential when troubleshooting service discovery and time synchronization issues.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Identifying Which Process Owns a Port
&lt;/h2&gt;

&lt;p&gt;One of the most useful commands in production environments:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Proto Local Address     PID/Program name
tcp   0.0.0.0:80        1245/nginx
tcp   0.0.0.0:3306      2210/mysqld
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This instantly reveals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Port 80 → Nginx&lt;/li&gt;
&lt;li&gt;Port 3306 → MySQL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When an application fails to start because a port is already in use, this command is often the fastest way to identify the culprit.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Investigating a Specific Port
&lt;/h2&gt;

&lt;p&gt;Suppose your application cannot bind to port 8080.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;netstat -tulpn &lt;span class="o"&gt;|&lt;/span&gt; grep 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 3521/java
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you know exactly which process owns the port.&lt;/p&gt;

&lt;p&gt;No guesswork required.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Analyzing Network Interfaces
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Iface   MTU RX-OK TX-OK
eth0    1500 152345 130987
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This provides insight into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Packet transmission&lt;/li&gt;
&lt;li&gt;Interface errors&lt;/li&gt;
&lt;li&gt;Network throughput&lt;/li&gt;
&lt;li&gt;Hardware-level issues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A useful command when diagnosing networking bottlenecks.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Viewing the Routing Table
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Destination Gateway     Genmask
0.0.0.0     10.0.0.1    0.0.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The routing table determines how traffic leaves the server.&lt;/p&gt;

&lt;p&gt;Misconfigured routes can cause:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connectivity failures&lt;/li&gt;
&lt;li&gt;Asymmetric routing&lt;/li&gt;
&lt;li&gt;Unexpected latency&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding routing is one of the hallmarks of a strong infrastructure engineer.&lt;/p&gt;




&lt;h2&gt;
  
  
  9. Security and Incident Response
&lt;/h2&gt;

&lt;p&gt;One of the most overlooked uses of netstat is threat hunting.&lt;/p&gt;

&lt;p&gt;Display all active TCP connections:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Focus on established sessions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;netstat -antp &lt;span class="o"&gt;|&lt;/span&gt; grep ESTABLISHED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Questions worth asking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why is this server communicating with that IP?&lt;/li&gt;
&lt;li&gt;Is this connection expected?&lt;/li&gt;
&lt;li&gt;Does this process belong here?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Many security investigations begin with network visibility.&lt;/p&gt;




&lt;h2&gt;
  
  
  Understanding TCP Connection States
&lt;/h2&gt;

&lt;p&gt;A mature engineer doesn't just read netstat output—they understand connection behavior.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;State&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;LISTEN&lt;/td&gt;
&lt;td&gt;Waiting for incoming connections&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ESTABLISHED&lt;/td&gt;
&lt;td&gt;Active connection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TIME_WAIT&lt;/td&gt;
&lt;td&gt;Connection recently closed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CLOSE_WAIT&lt;/td&gt;
&lt;td&gt;Remote side closed connection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYN_SENT&lt;/td&gt;
&lt;td&gt;Connection initiation in progress&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SYN_RECV&lt;/td&gt;
&lt;td&gt;Handshake underway&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A large number of &lt;code&gt;TIME_WAIT&lt;/code&gt; or &lt;code&gt;CLOSE_WAIT&lt;/code&gt; connections can indicate application-level problems that may impact performance.&lt;/p&gt;




&lt;h2&gt;
  
  
  Netstat vs SS
&lt;/h2&gt;

&lt;p&gt;Modern Linux distributions often recommend:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;because it is faster and more efficient.&lt;/p&gt;

&lt;p&gt;However, experienced engineers know both tools.&lt;/p&gt;

&lt;p&gt;Real-world environments still contain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Legacy servers&lt;/li&gt;
&lt;li&gt;Older distributions&lt;/li&gt;
&lt;li&gt;Long-running enterprise systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Knowing netstat remains valuable.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Junior engineers use netstat to check ports.&lt;/p&gt;

&lt;p&gt;Intermediate engineers use it to troubleshoot services.&lt;/p&gt;

&lt;p&gt;Senior engineers use it to understand system behavior.&lt;/p&gt;

&lt;p&gt;Security engineers use it to investigate threats.&lt;/p&gt;

&lt;p&gt;Infrastructure architects use it to visualize communication patterns across systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Netstat is not just a command—it is a window into the live network state of a machine.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Logs tell you what happened. Metrics tell you what changed. Netstat tells you what is happening right now."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Linux #DevOps #SysAdmin #Networking #CloudComputing #SRE #Infrastructure #CyberSecurity #Netstat #LinuxAdministration #OpenSource #PlatformEngineering #TechOps #ServerManagement #CommandLine #DevTo
&lt;/h1&gt;

</description>
      <category>devops</category>
      <category>systemdesign</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>Your server has open doors you don't know about.</title>
      <dc:creator>Sovrab Roy</dc:creator>
      <pubDate>Tue, 09 Jun 2026 19:57:41 +0000</pubDate>
      <link>https://dev.to/sovrab/your-server-has-open-doors-you-dont-know-about-535f</link>
      <guid>https://dev.to/sovrab/your-server-has-open-doors-you-dont-know-about-535f</guid>
      <description>&lt;p&gt;Open your terminal right now.&lt;br&gt;
Type this:&lt;br&gt;
sudo netstat -tulpn&lt;br&gt;
Every line = an open port on your server.&lt;br&gt;
A door that anyone on the internet can knock on.&lt;br&gt;
Do you recognize every single process on that list?&lt;/p&gt;

&lt;p&gt;Last year I audited a client's VPS.&lt;br&gt;
"It's just Nginx and MySQL," they said.&lt;br&gt;
The output told a different story:&lt;br&gt;
— Port 3306 → MySQL open to the entire internet&lt;br&gt;
— Port 6379 → Redis, zero authentication, fully exposed&lt;br&gt;
— Port 8080 → a forgotten staging app still running&lt;br&gt;
— Port 25 → SMTP open, server was a spam relay&lt;br&gt;
Four open doors. Six months undetected.&lt;br&gt;
The Redis exposure alone could have wiped their database in seconds.&lt;/p&gt;

&lt;p&gt;How to read the output:&lt;br&gt;
0.0.0.0 = accessible from ANY IP on the internet&lt;br&gt;
127.0.0.1 = localhost only, safe&lt;br&gt;
The most dangerous line you can see:&lt;br&gt;
tcp   0.0.0.0:3306   LISTEN   mysqld&lt;br&gt;
Your database. Open to the world. Just one password away from disaster.&lt;/p&gt;

&lt;p&gt;4 commands for a complete audit:&lt;br&gt;
See every open port:&lt;br&gt;
sudo netstat -tulpn&lt;br&gt;
See who is connected right now:&lt;br&gt;
sudo netstat -tnp | grep ESTABLISHED&lt;br&gt;
Find which process owns a port:&lt;br&gt;
sudo netstat -tlnp | grep :3306&lt;br&gt;
Top 10 IPs currently hitting your server:&lt;br&gt;
sudo netstat -tn | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -rn | head -10&lt;/p&gt;

&lt;p&gt;If MySQL is exposed — fix it now:&lt;/p&gt;

&lt;h1&gt;
  
  
  /etc/mysql/mysql.conf.d/mysqld.cnf
&lt;/h1&gt;

&lt;p&gt;bind-address = 127.0.0.1&lt;br&gt;
sudo systemctl restart mysql&lt;br&gt;
If Redis is exposed:&lt;/p&gt;

&lt;h1&gt;
  
  
  /etc/redis/redis.conf
&lt;/h1&gt;

&lt;p&gt;bind 127.0.0.1&lt;br&gt;
requirepass YourStrongPassword&lt;br&gt;
sudo systemctl restart redis&lt;/p&gt;

&lt;p&gt;My rule on every server I manage:&lt;br&gt;
If I cannot explain why a port is open — I close it.&lt;br&gt;
Every open port is an attack surface.&lt;br&gt;
Every forgotten service is a liability.&lt;br&gt;
Every exposed database is a breach waiting to happen.&lt;br&gt;
This command takes 3 seconds to run.&lt;br&gt;
Most people have never run it once.&lt;/p&gt;

&lt;p&gt;Run it right now.&lt;br&gt;
Did you find anything unexpected?&lt;br&gt;
Drop it in the comments — I respond to every single one.&lt;/p&gt;

&lt;h1&gt;
  
  
  serversecurity #linux #vpshosting #sysadmin #dedicatedserver
&lt;/h1&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>vps</category>
      <category>networking</category>
    </item>
    <item>
      <title>How I Recovered a Crashed WHM/cPanel Server and Restored Websites</title>
      <dc:creator>Sovrab Roy</dc:creator>
      <pubDate>Wed, 03 Jun 2026 20:40:05 +0000</pubDate>
      <link>https://dev.to/sovrab/how-i-recovered-a-crashed-whmcpanel-server-and-restored-websites-2945</link>
      <guid>https://dev.to/sovrab/how-i-recovered-a-crashed-whmcpanel-server-and-restored-websites-2945</guid>
      <description>&lt;h1&gt;
  
  
  How I Recovered a Crashed WHM/cPanel Server and Restored Websites
&lt;/h1&gt;

&lt;p&gt;A few days ago, a client contacted me because all websites hosted on their WHM/cPanel server suddenly went offline.&lt;/p&gt;

&lt;p&gt;The server was running on a Linux VPS with WHM/cPanel installed. Multiple websites were down, email services were not responding, and the client was concerned about potential data loss.&lt;/p&gt;

&lt;p&gt;In this article, I'll walk through the troubleshooting and recovery process I used.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Verify Server Accessibility
&lt;/h2&gt;

&lt;p&gt;First, I checked whether the server was reachable via SSH.&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@server-ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server was accessible, which meant the VPS itself was still running.&lt;/p&gt;

&lt;p&gt;I then checked the system load and uptime:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This helped identify whether the server was overloaded or suffering from resource exhaustion.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Check Disk Usage
&lt;/h2&gt;

&lt;p&gt;One of the most common causes of service failures on cPanel servers is a full disk.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;In this case, disk usage was critically high.&lt;/p&gt;

&lt;p&gt;To locate large files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;du -sh /var/* &lt;span class="o"&gt;|&lt;/span&gt; sort -h
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After identifying unnecessary log growth, old logs were cleaned safely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Verify Core Services
&lt;/h2&gt;

&lt;p&gt;Next, I checked the status of essential services.&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 httpd
systemctl status mysql
systemctl status named
systemctl status exim
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apache was not running correctly.&lt;/p&gt;

&lt;p&gt;To restart services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl restart httpd
systemctl restart mysql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Review Error Logs
&lt;/h2&gt;

&lt;p&gt;Logs provide the real story.&lt;/p&gt;

&lt;p&gt;Apache errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tail -100 /usr/local/apache/logs/error_log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;System messages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tail -100 /var/log/messages
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These logs revealed configuration issues that prevented Apache from starting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Validate Apache Configuration
&lt;/h2&gt;

&lt;p&gt;Before restarting production services, configuration should always be validated.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;After verification:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl restart httpd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Websites started loading again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Verify MySQL Health
&lt;/h2&gt;

&lt;p&gt;Database availability is critical for WordPress and dynamic websites.&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 mysql
mysqladmin ping
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Database services were functioning normally after recovery.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Check cPanel Services
&lt;/h2&gt;

&lt;p&gt;To ensure WHM and cPanel services were healthy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/usr/local/cpanel/scripts/restartsrv_cpsrvd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify service status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;service cpanel status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 8: Validate DNS and Email Services
&lt;/h2&gt;

&lt;p&gt;DNS:&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 named
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Email:&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 exim
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All services were tested and confirmed operational.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Verification
&lt;/h2&gt;

&lt;p&gt;After restoring services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Websites were accessible&lt;/li&gt;
&lt;li&gt;WHM login worked&lt;/li&gt;
&lt;li&gt;cPanel accounts loaded correctly&lt;/li&gt;
&lt;li&gt;Email delivery was functioning&lt;/li&gt;
&lt;li&gt;DNS resolution was successful&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Server recovery is rarely about running a single command. The key is following a structured troubleshooting process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Verify server access&lt;/li&gt;
&lt;li&gt;Check disk space&lt;/li&gt;
&lt;li&gt;Review service status&lt;/li&gt;
&lt;li&gt;Analyze logs&lt;/li&gt;
&lt;li&gt;Validate configurations&lt;/li&gt;
&lt;li&gt;Restore services safely&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By following a systematic approach, I was able to recover the crashed WHM/cPanel server and restore all hosted websites with minimal downtime.&lt;/p&gt;

&lt;p&gt;Have you ever dealt with a production server outage? Share your experience in the comments.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>whm</category>
      <category>security</category>
      <category>systems</category>
    </item>
    <item>
      <title>Advanced Linux Commands That Separate Senior Engineers From Beginners</title>
      <dc:creator>Sovrab Roy</dc:creator>
      <pubDate>Sat, 16 May 2026 11:44:08 +0000</pubDate>
      <link>https://dev.to/sovrab/advanced-linux-commands-that-separate-senior-engineers-from-beginners-31l8</link>
      <guid>https://dev.to/sovrab/advanced-linux-commands-that-separate-senior-engineers-from-beginners-31l8</guid>
      <description>&lt;h1&gt;
  
  
  🚀 Advanced Linux Commands That Separate Senior Engineers From Beginners
&lt;/h1&gt;

&lt;p&gt;Most people know &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;cd&lt;/code&gt;, and &lt;code&gt;grep&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;But real-world production troubleshooting needs a different level of Linux knowledge.&lt;/p&gt;

&lt;p&gt;Here are some advanced commands every serious DevOps/SRE/Linux engineer should know 👇&lt;/p&gt;




&lt;h2&gt;
  
  
  1️⃣ Trace system calls of a running process
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;strace -p &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;PID&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Helps debug:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hung processes&lt;/li&gt;
&lt;li&gt;File access issues&lt;/li&gt;
&lt;li&gt;Permission problems&lt;/li&gt;
&lt;li&gt;Network/system call failures&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2️⃣ See which process is secretly eating disk space
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lsof &lt;span class="o"&gt;|&lt;/span&gt; grep deleted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sometimes deleted log files still consume GBs of space because processes keep them open.&lt;/p&gt;




&lt;h2&gt;
  
  
  3️⃣ Real-time bandwidth monitoring
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;Perfect for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detecting traffic spikes&lt;/li&gt;
&lt;li&gt;Suspicious outbound traffic&lt;/li&gt;
&lt;li&gt;Network bottlenecks&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4️⃣ Trace packet flow like a network engineer
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tcpdump -i eth0 port 443
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Production debugging becomes much easier when you can actually see packets.&lt;/p&gt;




&lt;h2&gt;
  
  
  5️⃣ Find why a mount point won’t unmount
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;fuser -vm /mnt/data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shows which processes are using the filesystem.&lt;/p&gt;




&lt;h2&gt;
  
  
  6️⃣ Debug DNS resolution path
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig +trace example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Extremely useful during DNS propagation or routing issues.&lt;/p&gt;




&lt;h2&gt;
  
  
  7️⃣ Watch filesystem changes live
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;inotifywait -m /var/www/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Great for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security monitoring&lt;/li&gt;
&lt;li&gt;Deployment debugging&lt;/li&gt;
&lt;li&gt;File tracking&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  8️⃣ Investigate open network sockets
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;Modern replacement for &lt;code&gt;netstat&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  9️⃣ Find top resource-consuming processes instantly
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps aux --sort=-%mem &lt;span class="o"&gt;|&lt;/span&gt; head
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CPU heavy processes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps aux --sort=-%cpu &lt;span class="o"&gt;|&lt;/span&gt; head
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔟 Analyze disk usage properly
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;du -xh / &lt;span class="o"&gt;|&lt;/span&gt; sort -rh &lt;span class="o"&gt;|&lt;/span&gt; head -20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One of the fastest ways to identify storage problems.&lt;/p&gt;




&lt;h2&gt;
  
  
  1️⃣1️⃣ Monitor logs in real time with systemd
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;journalctl -fu nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  1️⃣2️⃣ SSH tunneling for secure internal access
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh -L 8080:localhost:80 user@server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Access internal services securely without exposing ports publicly.&lt;/p&gt;




&lt;h2&gt;
  
  
  1️⃣3️⃣ Find all failed SSH login attempts
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep &lt;span class="s2"&gt;"Failed password"&lt;/span&gt; /var/log/auth.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  1️⃣4️⃣ Generate load for testing
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;stress --cpu 8 --vm 2 --timeout 60
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  1️⃣5️⃣ See process tree hierarchy
&lt;/h2&gt;



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

&lt;/div&gt;






&lt;p&gt;💡 Senior engineers are not the ones who memorize the most commands.&lt;/p&gt;

&lt;p&gt;They are the ones who know exactly what to run during production chaos.&lt;/p&gt;

&lt;h1&gt;
  
  
  linux #devops #sre #sysadmin #cloud #bash #kubernetes #opensource #networking
&lt;/h1&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>bash</category>
      <category>sre</category>
    </item>
    <item>
      <title>How to Secure an Ubuntu Linux Server for Production</title>
      <dc:creator>Sovrab Roy</dc:creator>
      <pubDate>Fri, 08 May 2026 21:43:11 +0000</pubDate>
      <link>https://dev.to/sovrab/how-to-secure-an-ubuntu-linux-server-for-production-1j3p</link>
      <guid>https://dev.to/sovrab/how-to-secure-an-ubuntu-linux-server-for-production-1j3p</guid>
      <description>&lt;h1&gt;
  
  
  How to Secure an Ubuntu Linux Server for Production
&lt;/h1&gt;

&lt;p&gt;Securing a production Linux server is one of the most important responsibilities of a system administrator. A poorly configured server can become an easy target for brute-force attacks, malware, unauthorized access, and service disruption.&lt;/p&gt;

&lt;p&gt;In this guide, I’ll share essential steps to harden and secure an Ubuntu server for production environments.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Update Your Server Regularly
&lt;/h1&gt;

&lt;p&gt;Always keep your system packages updated to patch security vulnerabilities.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;You should also remove unused packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt autoremove -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  2. Create a Non-Root User
&lt;/h1&gt;

&lt;p&gt;Avoid using the root user directly for daily administration tasks.&lt;/p&gt;

&lt;p&gt;Create a new user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo adduser adminuser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the user to the sudo group:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo usermod -aG sudo adminuser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  3. Disable Root SSH Login
&lt;/h1&gt;

&lt;p&gt;Root login through SSH is a major security risk.&lt;/p&gt;

&lt;p&gt;Edit the SSH configuration file:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Find:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PermitRootLogin yes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change it to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PermitRootLogin no
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart SSH:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;






&lt;h1&gt;
  
  
  4. Change the Default SSH Port
&lt;/h1&gt;

&lt;p&gt;Changing the default SSH port helps reduce automated brute-force attacks.&lt;/p&gt;

&lt;p&gt;Inside the SSH config file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Port 2222
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart SSH:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Remember to allow the new port in your firewall.&lt;/p&gt;




&lt;h1&gt;
  
  
  5. Configure UFW Firewall
&lt;/h1&gt;

&lt;p&gt;Ubuntu comes with UFW (Uncomplicated Firewall).&lt;/p&gt;

&lt;p&gt;Allow required services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo ufw allow 2222/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable the firewall:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo ufw status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  6. Install Fail2Ban
&lt;/h1&gt;

&lt;p&gt;Fail2Ban blocks repeated failed login attempts automatically.&lt;/p&gt;

&lt;p&gt;Install it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt install fail2ban -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable and start the service:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo fail2ban-client status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  7. Use SSH Key Authentication
&lt;/h1&gt;

&lt;p&gt;SSH keys are much safer than passwords.&lt;/p&gt;

&lt;p&gt;Generate SSH keys on your local machine:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Copy the public key to the server:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Then disable password authentication:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PasswordAuthentication no
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart SSH afterward.&lt;/p&gt;




&lt;h1&gt;
  
  
  8. Secure Docker Containers
&lt;/h1&gt;

&lt;p&gt;If you use Docker in production:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid running containers as root&lt;/li&gt;
&lt;li&gt;Keep images updated&lt;/li&gt;
&lt;li&gt;Use trusted images only&lt;/li&gt;
&lt;li&gt;Limit exposed ports&lt;/li&gt;
&lt;li&gt;Scan images for vulnerabilities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Update Docker regularly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  9. Enable Automatic Security Updates
&lt;/h1&gt;

&lt;p&gt;Install unattended upgrades:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt install unattended-upgrades -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable automatic security updates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo dpkg-reconfigure unattended-upgrades
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  10. Monitor Logs and System Activity
&lt;/h1&gt;

&lt;p&gt;Regular monitoring helps detect suspicious activity early.&lt;/p&gt;

&lt;p&gt;Useful commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo journalctl -xe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo tail -f /var/log/auth.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use tools like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prometheus&lt;/li&gt;
&lt;li&gt;Grafana&lt;/li&gt;
&lt;li&gt;Netdata&lt;/li&gt;
&lt;li&gt;Uptime Kuma&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  11. Backup Your Server
&lt;/h1&gt;

&lt;p&gt;Always maintain secure backups.&lt;/p&gt;

&lt;p&gt;Recommended practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Daily automated backups&lt;/li&gt;
&lt;li&gt;Offsite storage&lt;/li&gt;
&lt;li&gt;Database dumps&lt;/li&gt;
&lt;li&gt;Backup verification&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rsync&lt;/li&gt;
&lt;li&gt;BorgBackup&lt;/li&gt;
&lt;li&gt;Restic&lt;/li&gt;
&lt;li&gt;Rclone&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Server security is not a one-time setup. It’s an ongoing process that requires continuous monitoring, updates, and optimization.&lt;/p&gt;

&lt;p&gt;A properly secured Ubuntu server reduces risks, improves reliability, and helps maintain stable production environments.&lt;/p&gt;

&lt;p&gt;If you’re managing Linux servers in production, implementing these security practices is essential.&lt;/p&gt;




&lt;h1&gt;
  
  
  linux #ubuntu #security #devops
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>linux</category>
      <category>security</category>
      <category>devops</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Useful Linux Commands Every System Administrator Should Know</title>
      <dc:creator>Sovrab Roy</dc:creator>
      <pubDate>Thu, 07 May 2026 21:41:24 +0000</pubDate>
      <link>https://dev.to/sovrab/useful-linux-commands-every-system-administrator-should-know-3141</link>
      <guid>https://dev.to/sovrab/useful-linux-commands-every-system-administrator-should-know-3141</guid>
      <description>&lt;h1&gt;
  
  
  Useful Linux Commands Every System Administrator Should Know
&lt;/h1&gt;

&lt;p&gt;Linux system administration becomes much easier when you know the right commands for monitoring, troubleshooting, and managing servers efficiently.&lt;/p&gt;

&lt;p&gt;In this article, I’ll share some useful Linux commands that I regularly use while managing production servers and cloud infrastructure environments.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Check System Uptime
&lt;/h1&gt;



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

&lt;/div&gt;



&lt;p&gt;Displays:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;server uptime&lt;/li&gt;
&lt;li&gt;current load average&lt;/li&gt;
&lt;li&gt;active users&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Useful for quick server health checks.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. Monitor Running Processes
&lt;/h1&gt;



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

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Helps identify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;high CPU usage&lt;/li&gt;
&lt;li&gt;memory consumption&lt;/li&gt;
&lt;li&gt;overloaded processes&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  3. Check Disk Usage
&lt;/h1&gt;



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

&lt;/div&gt;



&lt;p&gt;Displays disk space usage in human-readable format.&lt;/p&gt;




&lt;h1&gt;
  
  
  4. Analyze Directory Sizes
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;du -sh *
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Very useful when troubleshooting storage problems.&lt;/p&gt;




&lt;h1&gt;
  
  
  5. Check Memory Usage
&lt;/h1&gt;



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

&lt;/div&gt;



&lt;p&gt;Shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RAM usage&lt;/li&gt;
&lt;li&gt;swap usage&lt;/li&gt;
&lt;li&gt;available memory&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  6. View Running Services
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl list-units --type=service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Manage services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo systemctl restart nginx
sudo systemctl status mysql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  7. Monitor Network Connections
&lt;/h1&gt;



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

&lt;/div&gt;



&lt;p&gt;Useful for checking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open ports&lt;/li&gt;
&lt;li&gt;active services&lt;/li&gt;
&lt;li&gt;listening processes&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  8. Search Logs Efficiently
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tail -f /var/log/syslog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Essential for troubleshooting server issues.&lt;/p&gt;




&lt;h1&gt;
  
  
  9. Secure File Permissions
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;chmod 644 file.txt
chmod 755 script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Understanding Linux permissions is critical for server security.&lt;/p&gt;




&lt;h1&gt;
  
  
  10. Check Server IP Address
&lt;/h1&gt;



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

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;






&lt;h1&gt;
  
  
  11. Test Server Connectivity
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;traceroute google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  12. Monitor Real-Time Resource Usage
&lt;/h1&gt;



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

&lt;/div&gt;



&lt;p&gt;Provides live system performance statistics.&lt;/p&gt;




&lt;h1&gt;
  
  
  13. Docker Management Commands
&lt;/h1&gt;

&lt;p&gt;List containers:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;View logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker logs container_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker restart container_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  14. Secure SSH Access
&lt;/h1&gt;

&lt;p&gt;Restart SSH:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Check SSH port:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo ss -tulpn &lt;span class="o"&gt;|&lt;/span&gt; grep ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Linux commands are powerful tools for server administration, monitoring, troubleshooting, and infrastructure management.&lt;/p&gt;

&lt;p&gt;A strong understanding of Linux fundamentals helps system administrators maintain stable, secure, and high-performance production environments.&lt;/p&gt;

&lt;p&gt;I regularly work with Linux servers, Docker, cPanel/WHM, hosting technologies, and cloud infrastructure optimization.&lt;/p&gt;

&lt;p&gt;🌐 Portfolio:&lt;br&gt;
&lt;a href="https://sovrabroy.online" rel="noopener noreferrer"&gt;https://sovrabroy.online&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  linux #devops #bash #serveradministration
&lt;/h1&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>security</category>
      <category>bash</category>
    </item>
    <item>
      <title>Essential Linux Server Hardening Steps for Production Environments</title>
      <dc:creator>Sovrab Roy</dc:creator>
      <pubDate>Wed, 06 May 2026 22:07:26 +0000</pubDate>
      <link>https://dev.to/sovrab/essential-linux-server-hardening-steps-for-production-environments-3gm1</link>
      <guid>https://dev.to/sovrab/essential-linux-server-hardening-steps-for-production-environments-3gm1</guid>
      <description>&lt;h1&gt;
  
  
  Essential Linux Server Hardening Steps for Production Environments
&lt;/h1&gt;

&lt;p&gt;Securing a Linux server is one of the most important responsibilities of a system administrator. A poorly configured server can become vulnerable to brute-force attacks, malware, privilege escalation, and unauthorized access.&lt;/p&gt;

&lt;p&gt;In this article, I will share some essential Linux server hardening steps that I usually apply after deploying a fresh Ubuntu or Debian server for production use.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Update System Packages
&lt;/h1&gt;

&lt;p&gt;The first thing I do is update all installed packages and security patches.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Keeping packages updated reduces security vulnerabilities and improves server stability.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. Create a Non-Root Sudo User
&lt;/h1&gt;

&lt;p&gt;Using the root account directly is risky. Instead, create a separate sudo user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adduser sovrab
usermod -aG sudo sovrab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This improves accountability and reduces direct root exposure.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. Disable Root SSH Login
&lt;/h1&gt;

&lt;p&gt;Root login through SSH should be disabled to prevent brute-force attacks.&lt;/p&gt;

&lt;p&gt;Edit the SSH configuration file:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Find:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Change it to:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Restart SSH service:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;






&lt;h1&gt;
  
  
  4. Change Default SSH Port
&lt;/h1&gt;

&lt;p&gt;Changing the default SSH port from 22 to another custom port helps reduce automated attack attempts.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Do not forget to allow the new port through the firewall.&lt;/p&gt;




&lt;h1&gt;
  
  
  5. Configure UFW Firewall
&lt;/h1&gt;

&lt;p&gt;Ubuntu ships with UFW (Uncomplicated Firewall), which is easy to configure.&lt;/p&gt;

&lt;p&gt;Allow SSH port:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo ufw allow 2222/tcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable firewall:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo ufw status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  6. Install Fail2Ban
&lt;/h1&gt;

&lt;p&gt;Fail2Ban protects servers from repeated failed login attempts.&lt;/p&gt;

&lt;p&gt;Install:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt install fail2ban -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable and start:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo fail2ban-client status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  7. Configure Automatic Security Updates
&lt;/h1&gt;

&lt;p&gt;Automatic security updates help patch vulnerabilities quickly.&lt;/p&gt;

&lt;p&gt;Install unattended upgrades:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt install unattended-upgrades
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo dpkg-reconfigure unattended-upgrades
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  8. Disable Unused Services
&lt;/h1&gt;

&lt;p&gt;Unused services increase attack surfaces.&lt;/p&gt;

&lt;p&gt;Check running services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo systemctl list-units --type=service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Disable unnecessary services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo systemctl disable service-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  9. Monitor Server Resources
&lt;/h1&gt;

&lt;p&gt;Resource monitoring helps detect unusual activity and performance bottlenecks.&lt;/p&gt;

&lt;p&gt;Useful commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;htop
df -h
free -m
uptime
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  10. Secure Shared Hosting Environments
&lt;/h1&gt;

&lt;p&gt;For cPanel or shared hosting servers, additional security measures are recommended:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure CSF firewall&lt;/li&gt;
&lt;li&gt;Enable ModSecurity&lt;/li&gt;
&lt;li&gt;Harden PHP functions&lt;/li&gt;
&lt;li&gt;Use CloudLinux isolation&lt;/li&gt;
&lt;li&gt;Enable ImunifyAV or Imunify360&lt;/li&gt;
&lt;li&gt;Configure secure backups&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  11. Backup Strategy
&lt;/h1&gt;

&lt;p&gt;Backups are critical for disaster recovery.&lt;/p&gt;

&lt;p&gt;Important backup locations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Website files&lt;/li&gt;
&lt;li&gt;MySQL databases&lt;/li&gt;
&lt;li&gt;Configuration files&lt;/li&gt;
&lt;li&gt;DNS zones&lt;/li&gt;
&lt;li&gt;Email accounts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I usually automate backups using shell scripts and remote storage solutions.&lt;/p&gt;




&lt;h1&gt;
  
  
  12. Docker Security Basics
&lt;/h1&gt;

&lt;p&gt;If Docker is installed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid running containers as root&lt;/li&gt;
&lt;li&gt;Use trusted images only&lt;/li&gt;
&lt;li&gt;Keep images updated&lt;/li&gt;
&lt;li&gt;Limit container privileges&lt;/li&gt;
&lt;li&gt;Monitor exposed ports&lt;/li&gt;
&lt;/ul&gt;

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

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

&lt;/div&gt;






&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Linux server hardening is not a one-time task. Security requires continuous monitoring, patching, auditing, and optimization.&lt;/p&gt;

&lt;p&gt;A properly secured Linux server improves reliability, uptime, and infrastructure stability while reducing security risks.&lt;/p&gt;

&lt;p&gt;As a Linux System Administrator and Server Engineer, I regularly work with Linux servers, cloud infrastructure, Docker, cPanel, hosting technologies, and production environment optimization.&lt;/p&gt;

&lt;p&gt;🌐 Portfolio:&lt;br&gt;
&lt;a href="https://sovrabroy.online" rel="noopener noreferrer"&gt;https://sovrabroy.online&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  linux #devops #cloud #docker #serveradministration
&lt;/h1&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>cloud</category>
      <category>git</category>
    </item>
    <item>
      <title>Hello DEV Community 👋

I'm Sovrab Roy, a Linux System Administrator &amp; Server Engineer from Bangladesh.

I work with Linux servers, cloud infrastructure, cPanel, Docker, hosting technologies, and server optimization.

Looking forward to sharing technical</title>
      <dc:creator>Sovrab Roy</dc:creator>
      <pubDate>Wed, 06 May 2026 22:02:07 +0000</pubDate>
      <link>https://dev.to/sovrab/hello-dev-community-im-sovrab-roy-a-linux-system-administrator-server-engineer-from-1l7e</link>
      <guid>https://dev.to/sovrab/hello-dev-community-im-sovrab-roy-a-linux-system-administrator-server-engineer-from-1l7e</guid>
      <description></description>
      <category>community</category>
      <category>docker</category>
      <category>infrastructure</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
