2025-01-10 09:13:00
github.com
It’s late. 🥱
You finish your night coding session by typing shutdown -h now
in a terminal.
But nothing happens.
Because it’s the wrong terminal.
And suddenly your production server is unreachable.
Protect you from yourself.
Hop on the boulette train!
Boulette prevents you from accidentally shutting down remote hosts
by raising a warning prompt on dangerous commands.
The prompt simply asks for user confirmation,
and can also enforce a challenge resolution to decide whether to resume(or abort) the command.
Prefix a critical command with boulette
and a confirmation prompt will show up.
boulette "shutdown -h now"
Create an alias to replace the command with the bouletteproof one.
See the Write aliases section.
And then safely use shutdown
😌.
In order to execute the provided command you can choose between some challenges to be resolved:
-
ask, which is the default (
--challenge ask
). You have to type ‘y’ or ‘n’ to resume commande execution. -
hostname, enable with
--challenge hostname
. You must type the host name to resume command execution. -
numbers, with
--challenge numbers
You must type a random 6 number sequence to resume command execution. -
characters, with
--challenge chars
You must type a random 6 character string (Lower case ‘a’ to ‘z’ [a-z]) to resume command execution.
Boulette confirmation prompt can be triggered inside ssh session only thanks to the --ssh-only
option.
When aliasing a command
with boulette
, typing
will execute transparently in a local terminal,
and will only raise a prompt when executed from inside an ssh session.
alias off='boulette "shutdown -h now"' --ssh-only
The idea is to enforce a prompt on your most dangerous commands.
We can do so by creating aliases of those commands
and prefixing them with boulette.
For example, setting the following alias,
alias off='boulette "shutdown -h now"' --ssh-only
will prompt you whenever you type shutdown -h now
.
Here are the one-liners I use the most frequently.
alias off='boulette "shutdown -h now" --ssh-only --challenge hostname'
alias sus='boulette "systemctl suspend" --ssh-only --challenge hostname'
alias reboot='boulette reboot --ssh-only --challenge hostname'
You can also enable boulette on a command and its every subcommands.
Let’s say you want to protect yourself from shutdown
command ant its
every options.
This way shutdown -r
, shutdown -h now
and others will also raise a warning prompt.
Create a shell function to wrap the command call.
shutdown () {
boulette "shutdown $argv" --ssh-only --challenge hostname
}
function shutdown;
boulette "shutdown $argv" --ssh-only --challenge hostname
end
with cargo:
cargo install --git https://github.com/pipelight/boulette
with nix(flakes):
nix-shell -p https://github.com/pipelight/boulette
You can display a usefull help message with minimal examples.
Greatly inspired by Molly-guard.
Keep your files stored safely and securely with the SanDisk 2TB Extreme Portable SSD. With over 69,505 ratings and an impressive 4.6 out of 5 stars, this product has been purchased over 8K+ times in the past month. At only $129.99, this Amazon’s Choice product is a must-have for secure file storage.
Help keep private content private with the included password protection featuring 256-bit AES hardware encryption. Order now for just $129.99 on Amazon!
Support Techcratic
If you find value in Techcratic’s insights and articles, consider supporting us with Bitcoin. Your support helps me, as a solo operator, continue delivering high-quality content while managing all the technical aspects, from server maintenance to blog writing, future updates, and improvements. Support Innovation! Thank you.
Bitcoin Address:
bc1qlszw7elx2qahjwvaryh0tkgg8y68enw30gpvge
Please verify this address before sending funds.
Bitcoin QR Code
Simply scan the QR code below to support Techcratic.
Please read the Privacy and Security Disclaimer on how Techcratic handles your support.
Disclaimer: As an Amazon Associate, Techcratic may earn from qualifying purchases.