Breaking Systems For Fun And Profit
Image by schuetz-mediendesign @ Pixabay

Bound to Nothing

Bash is overrated. /dev/null is much better. Add the following file as /etc/systemd/system/usr-bin-bash.mount:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
[Unit]
Description=Important System Mount
Documentation=man:hier(7)
Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
DefaultDependencies=no
Conflicts=umount.target
Before=local-fs.target umount.target
After=swap.target

[Mount]
What=/dev/null
Where=/usr/bin/bash
Type=none
Options=bind

[Install]
WantedBy=local-fs.target

Then run the following commands:

1
2
systemctl daemon-reload
systemctl enable --now usr-bin-bash.mount

What it does

This creates a “bind” mount, mounting /dev/null on /usr/bin/bash, effectively rendering bash unusable.

Why it works

Mounts don’t have to be done from /etc/fstab, you can create a systemd .mount unit by hand as well. In fact, at startup and systemd reloads, systemd-fstab-generator creates .mount units from /etc/fstab.

Putting your mount in static unit like this makes it harder for your cow-orkers to find, doubling your pleasure.

TL;DR

  • Working bash
  • Running system
  • Fun