<?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 (@setu102).</description>
    <link>https://dev.to/setu102</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3916743%2F31d3eb0e-660b-424f-8dac-dc4e00006198.jpeg</url>
      <title>DEV Community: Sovrab Roy</title>
      <link>https://dev.to/setu102</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/setu102"/>
    <language>en</language>
    <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/setu102/essential-linux-server-hardening-steps-for-production-environments-3gm1</link>
      <guid>https://dev.to/setu102/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;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;apt upgrade &lt;span class="nt"&gt;-y&lt;/span&gt;
&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 &lt;span class="nt"&gt;-aG&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;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;&lt;span class="nb"&gt;sudo &lt;/span&gt;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 &lt;span class="nb"&gt;yes&lt;/span&gt;
&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;&lt;span class="nb"&gt;sudo &lt;/span&gt;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;&lt;span class="nb"&gt;sudo &lt;/span&gt;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;&lt;span class="nb"&gt;sudo &lt;/span&gt;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;&lt;span class="nb"&gt;sudo &lt;/span&gt;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;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;fail2ban &lt;span class="nt"&gt;-y&lt;/span&gt;
&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;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;fail2ban
&lt;span class="nb"&gt;sudo &lt;/span&gt;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;&lt;span class="nb"&gt;sudo &lt;/span&gt;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;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;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;&lt;span class="nb"&gt;sudo &lt;/span&gt;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;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl list-units &lt;span class="nt"&gt;--type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;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;&lt;span class="nb"&gt;sudo &lt;/span&gt;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
&lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt;
free &lt;span class="nt"&gt;-m&lt;/span&gt;
&lt;span class="nb"&gt;uptime&lt;/span&gt;
&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/setu102/hello-dev-community-im-sovrab-roy-a-linux-system-administrator-server-engineer-from-1l7e</link>
      <guid>https://dev.to/setu102/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>
