Throw Insults when a user type the wrong password.

The SUDOERS file includes a fun hidden gem within the default sudo security policy: the “insults” feature. When enabled, this option causes sudo to throw humorous or sarcastic insults at users each time they enter an incorrect password. By default, this flag is turned off.

Throw Insults when a user type the wrong password.
Image credit: Unknown. Please contact us if you are the owner.

By default, the sudo command prompts an error message on entering the wrong password; such as:

$ sudo apt update
[sudo] password for monkey:
"Sorry, try again"


...but if you're in the mood for some playful feedback we can tweak it a bit to make things more fun; by making it dynamic, the system can randomly select and throw insults whenever you type the wrong password.


/etc/sudoers



The sudoers file, Linux's default sudo security policy plugin, allows system administrators to define user permissions and manage security policies. One of the more entertaining options in this configuration is the Defaults insults directive. When this is enabled in /etc/sudoers, sudo will throw playful insults each time a user enters an incorrect password. By default, this feature is disabled, but adding Defaults insults to the sudoers file provides a bit of humor to lighten the command-line experience while keeping security controls intact.

Enable Defaults insults



*Always use visudo to edit your sudoers file—it includes a self-check system that prevents accidental errors.

1. Open the sudoers

$ sudo visudo


2. Add the following line in the file to the defaults section:

Defaults insults
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

Defaults        insults

# Host alias specification

# User alias specification

# Cmnd alias specification
...

..

.

Now, each time an incorrect password is entered, sudo will randomly display an insult.

Here are some examples:

[sudo] password for monkey: 
I fart in your general direction!
[sudo] password for monkey: 
When you're walking home tonight, and some homicidal maniac comes after you with a bunch of loganberries, don't come crying to me!
[sudo] password for monkey: 
There's nothing wrong with you that an expensive operation can't prolong.
[sudo] password for monkey: 
What, what, what, what, what, what, what, what, what, what?
[sudo] password for monkey: 
Maybe if you used more than just two fingers...



badpass_message parameter


The badpass_message parameter in Linux is a setting within the sudoers configuration that defines the message displayed when a user enters an incorrect password while using sudo. By default, when a password is entered incorrectly, sudo responds with "Sorry, try again."
However, by customizing badpass_message, system administrators can replace this default response with a personalized message.

Customization

1. Open the sudoers

$ sudo visudo


2. Add the following line (...add whatever comes across your mind; we trust you on that!):

Defaults  badpass_message=" Oopsie Daisy! That's password is wrong; try again"



With these changes, every time a user enters the wrong password for sudo, they'll see your custom message instead of the default one. This can be useful for adding a bit of personality or providing specific guidance when an error occurs.

We trust these tips were useful to you!

Keep Us Caffeinated  ⦿ ⦿