The sys admin's daily grind: sudoers
Charly's Column – sudoersn
"I've seen penguins that can type better than that." If you give sudo the wrong password, you deserve to be shouted at, says sys admin columnist Charly. He is not exempt from the insult and sees it as an opportunity to raise sudoing awareness.
If you work with and on Linux, you are likely to type sudo
regularly to execute programs with another user's privileges – typically the superuser's. sudo
will then understandably ask for the appropriate password. In times when my fingers refuse to obey me and I enter the secret password wrong three times in succession, sudo
rejects my request to escalate. Okay, if you fail to type the password correctly despite having had three attempts, maybe you shouldn't be messing around on the system with root privileges. So far, so good, but free software can surely offer more than that!
sudo visudo
sudo
looks for its default settings in the /etc/sudoers
file. You can't just open it with an editor; instead, you need to use the visudo
command – assuming you're root. (If I'm on the road as a user, I have to type sudo visudo
, which strangely makes me laugh.) At the beginning of the file are some lines that start with Defaults. You need to add two lines here (Figure 1):
Defaults insults Defaults passwd_tries=5
The first line causes sudo
to output a silly saying after every wrong input. The second line increases the number of allowed failed attempts to five. To test this, I deliberately acted stupid again and got the result shown in Figure 2.
Tomorrow's world: I was wondering whether I could perhaps store some insults customized for myself – or better still, for my favorite co-workers? Yes, I can! You need to store a string in /etc/sudoers
, which is displayed after typing the wrong password:
Defaults badpass_message="You shall not pass!"
For this to work, you have to remove the Defaults insults
entry.
"Just What Do You Think You're Doing, Dave?"
That's not bad. A list of different answers, from which sudo
then randomly selects one, would be even better of course. Unfortunately, this only works by changing the answers in the source code and then recompiling them.
I found some source code files containing useful sayings online [1]: ins_2001.h
, ins_classic.h
, ins_python.h
, ins_goons.h
, ins_csops.h
, and insults.h
.
The file names indicate the movies or TV shows from which the quotes are taken. The ins_python.h
file has nothing to do with the programming language, of course, but contains legendary sayings from Monty Python, such as, "I fart in your general direction!".
While I am suffering from regular verbal humiliation, the thought occurred to me that I could announce a competition among my co-workers for the best sudo
insults. See you next time, dummies!
Infos
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.