<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Systemd on My IT Journal</title>
    <link>https://my-it-blog.netlify.app/tags/systemd/</link>
    <description>Recent content in Systemd on My IT Journal</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 11 Jun 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://my-it-blog.netlify.app/tags/systemd/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>GRUB Security Lab: Boot-Time Privilege Escalation &amp; Hardening</title>
      <link>https://my-it-blog.netlify.app/posts/grub-security-lab/</link>
      <pubDate>Thu, 11 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://my-it-blog.netlify.app/posts/grub-security-lab/</guid>
      <description>&lt;h2 id=&#34;attack-simulation-gaining-root-access-via-grub&#34;&gt;Attack Simulation: Gaining Root Access via GRUB&lt;/h2&gt;
&lt;h3 id=&#34;objective&#34;&gt;Objective&lt;/h3&gt;
&lt;p&gt;Demonstrate how physical access to a Linux system can be abused to gain root privileges by modifying GRUB boot parameters.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;OS: Linux Ubuntu&lt;/li&gt;
&lt;li&gt;Access to GRUB menu during boot&lt;/li&gt;
&lt;li&gt;No GRUB password protection enabled&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&#34;attack-steps&#34;&gt;Attack Steps&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Reboot the system and access the GRUB menu.&lt;/li&gt;
&lt;li&gt;Select the default Linux entry and press e to edit boot parameters.&lt;/li&gt;
&lt;li&gt;Locate the line starting with: linux /boot/vmlinuz-&amp;hellip;&lt;/li&gt;
&lt;li&gt;Modify the line&lt;/li&gt;
&lt;li&gt;Boot the modified entry using Ctrl + X&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=&#34;grub_systemd&#34; loading=&#34;lazy&#34; src=&#34;https://my-it-blog.netlify.app/posts/grub-security-lab/grub_systemd.png&#34;&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>USB Automounting with systemd</title>
      <link>https://my-it-blog.netlify.app/posts/usb-automounting/</link>
      <pubDate>Sat, 06 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://my-it-blog.netlify.app/posts/usb-automounting/</guid>
      <description>&lt;h2 id=&#34;objective&#34;&gt;Objective&lt;/h2&gt;
&lt;p&gt;Setting up automatic USB drive mounting on a Linux server using systemd mount and automount units&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;environment&#34;&gt;Environment&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;OS: Ubuntu&lt;/li&gt;
&lt;li&gt;Tools: system, USB drive&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&#34;step-1---find-partition-uuid&#34;&gt;Step 1 - Find Partition UUID&lt;/h2&gt;
&lt;p&gt;Prerequisite: Plugin USB drive&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;blkid /dev/sdb1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;img alt=&#34;sdb1&#34; loading=&#34;lazy&#34; src=&#34;https://my-it-blog.netlify.app/posts/usb-automounting/sdb1.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;Note: UUID and filesystem type&lt;/p&gt;
&lt;h2 id=&#34;step-2---create-the-mount-unit&#34;&gt;Step 2 - Create the Mount Unit&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo nano /etc/systemd/system/mnt-usb.mount
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;img alt=&#34;mnt-usb.mount&#34; loading=&#34;lazy&#34; src=&#34;https://my-it-blog.netlify.app/posts/usb-automounting/mnt-usb_mount.png&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;step-3---create-automount-unit&#34;&gt;Step 3 - Create Automount Unit&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo nano /etc/systemd/system/mnt-usb.automount
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;img alt=&#34;mnt-usb.automount&#34; loading=&#34;lazy&#34; src=&#34;https://my-it-blog.netlify.app/posts/usb-automounting/mnt-usb_automount.png&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;step-4---enable-and-start&#34;&gt;Step 4 - Enable and Start&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo systemctl enable mnt-usb.automount
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo systemctl start mnt-usb.automount
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;step-5---verify-and-test&#34;&gt;Step 5 - Verify and test&lt;/h2&gt;
&lt;p&gt;Check the automount is active:&lt;/p&gt;</description>
    </item>
    <item>
      <title>DNS Lab - Dnsmasq, Client resolver, Caching</title>
      <link>https://my-it-blog.netlify.app/posts/dns-server/</link>
      <pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate>
      <guid>https://my-it-blog.netlify.app/posts/dns-server/</guid>
      <description>&lt;h1 id=&#34;-dns-lab&#34;&gt;🧪 DNS Lab&lt;/h1&gt;
&lt;h2 id=&#34;-objective&#34;&gt;📌 Objective&lt;/h2&gt;
&lt;p&gt;Understand DNS from a systems perpective&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;-environment&#34;&gt;⚙️ Environment&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Virtualization: VirtualBox&lt;/li&gt;
&lt;li&gt;OS: ( 1 DNS Server VM + 1 Client VM)&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&#34;-lab-network-topology&#34;&gt;🛠️ Lab Network Topology&lt;/h2&gt;
&lt;h3 id=&#34;-phase-1--direct-dns-no-cache&#34;&gt;🧩 Phase 1 — Direct DNS (No Cache)&lt;/h3&gt;
&lt;p&gt;Client VM -&amp;gt; dnsmasq (192.168.10.10)&lt;/p&gt;
&lt;p&gt;Used for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Break #1 (Wrong DNS Server)&lt;/li&gt;
&lt;li&gt;Break #2 (Wrong DNS Record)&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&#34;-phase-2--direct-dns-no-cache&#34;&gt;🧩 Phase 2 — Direct DNS (No Cache)&lt;/h3&gt;
&lt;p&gt;Clint VM -&amp;gt; systemd-resolved (127.0.0.53) [CACHE] -&amp;gt; dnsmasq (192.168.10.10) [DNS SERVER]&lt;/p&gt;</description>
    </item>
    <item>
      <title>Systemd Restart Behavior: Why Restart=on-failure Didn&#39;t Work</title>
      <link>https://my-it-blog.netlify.app/posts/systemd-restart-behavior/</link>
      <pubDate>Tue, 14 Apr 2026 00:00:00 +0000</pubDate>
      <guid>https://my-it-blog.netlify.app/posts/systemd-restart-behavior/</guid>
      <description>&lt;h1 id=&#34;-systemd-service-restart-behavior-lab&#34;&gt;🧪 Systemd Service Restart Behavior Lab&lt;/h1&gt;
&lt;h2 id=&#34;-objective&#34;&gt;📌 Objective&lt;/h2&gt;
&lt;p&gt;To test and understand how &lt;code&gt;systemd&lt;/code&gt; handles automatic service restarts using the &lt;code&gt;Restart=on-failure&lt;/code&gt; policy.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;-environment&#34;&gt;⚙️ Environment&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;OS: Ubuntu (systemd-based)&lt;/li&gt;
&lt;li&gt;Tools: systemctl, journalctl, bash&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&#34;-setup&#34;&gt;🛠️ Setup&lt;/h2&gt;
&lt;h3 id=&#34;1-create-a-test-script&#34;&gt;1. Create a test script&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo nano /usr/local/bin/labtest.sh
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/bash&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt; true; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;lab service is alive: &lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;date&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	sleep &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make it executable:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo chmod +x /usr/local/bin/labtest.sh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;h3 id=&#34;2-create-a-system-service&#34;&gt;2. Create a system service&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo nano /etc/systemd/system/labtest.service
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Unit&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Description&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;Lab test service
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;After&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;network.target
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Service&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ExecStart&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr/local/bin/labtest.sh
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Restart&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;on-failure
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;StandardOutput&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;journal
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Install&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;WantedBy&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;multi-user.target
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;h3 id=&#34;step-3--start-the-service&#34;&gt;Step 3 — Start the service&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo systemctl daemon-reload
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo systemctl enable labtest
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo systemctl start labtest
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;systemctl status labtest
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;img alt=&#34;Status&#34; loading=&#34;lazy&#34; src=&#34;https://my-it-blog.netlify.app/posts/systemd-restart-behavior/labtest-status.png&#34;&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
