Make Sudo Insult User For Each Incorrect Password Attempt

Have fun with sudo. Tweak sudo settings a bit so that it throws insults at users for each incorrect password attempt.
Warp Terminal

You can have lots of fun in the Linux terminal. And I am not talking about those funny commands to run a train in Linux terminal.

I am talking about little tweaks in the terminal that will lighten up your mood. In a previous article, you learned how to increase sudo timeout in Linux terminal. In today’s fun post, I’ll show you how you can make sudo insult you (or other users) when an incorrect password is attempted with the sudo command.

Confused what I am talking about? Here, take a look at this example to get a gist of how sudo can insult you for typing in the incorrect password.

sudo insults when a wrong password is entered
sudo insults when a wrong password is entered

Now, why would you do that and take insults? After all, insults are not going to brighten up your day, is it?

To me, this little tweak is funny and is better than the plain old “incorrect password” error message. Moreover, I can show it off to my friends (in this case you, via It’s FOSS) to amuse them. I am pretty sure you can come up with your own reason to use this tweak.

Enable insults in sudo

You can enable insults in sudo by adding the following line in the sudo configuration:

Defaults 	insults

Let’s see how to do that. Open a terminal and use the following command:

sudo visudo

This should open the configuration file in nano. Yeah, I know that traditionally ‘visudo’ should open the /etc/sudoers file in Vi editor, but Ubuntu and Ubuntu-based Linux distributions will open it in nano editor. Since we are talking about Vi, here is a cheat sheet for Vi editor that could come in handy if you decide to use Vi.

Or you can use the command below to open it in nano:

sudo EDITOR=nano visudo

Coming back to editing the sudoers file, you need to find the section where Defaults are listed. Luckily, it is in the beginning itself. Just add a “Defaults insults” line to it, like this:

Editing the sudoers file to add the Default Insults line
Editing the sudoers file to add the Default Insults line

If you are using nano, use Ctrl+X to quit the editor. At the time of quitting, it will ask you if you want to save the changes or not. To save the changes, press Y and then press Enter.

Save the file in the nano editor
Save the file in the nano editor

Here's a replay of the above process.

Editing visudo to add Defaults Insults line

Once you have saved the changes in the sudoers file, open a terminal and use any command with sudo. Deliberately type wrong passwords and enjoy the abuses :)

Sudo insults us when we enter a wrong password
Sudo insults us when we enter a wrong password

In the end...

📋
It is possible to add your own insults sentences to sudo. But for this, you need to recompile sudo, which is not recommended for various security reasons.

Speaking of incorrect passwords, I hope you know how to change the sudo password in Ubuntu.

How to Change User Password in Ubuntu [Beginner’s Tutorial]
Want to change root password in Ubuntu? Learn how to change the password for any user in Ubuntu Linux. Both terminal and GUI methods have been discussed. When do you need to change the password in Ubuntu? Let me give you a couple of scenarios. When you install Ubuntu, you

If you like this terminal hack, check out other terminal tricks posts as well. If you have other such fun tweaks and hacks, do share them in the comment box below.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.