The Wayback Machine - https://web.archive.org/web/20240118184058/https://www.geeksforgeeks.org/when-sudo-insults-you/
Open In App
Related Articles

When sudo insults you!!

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

An interesting sudo feature is the ability to insult you (not literally) when you type a wrong password and it has some really funny phrases to insult you. You can define sudoers insults option or several others in the file below. It is set under defaults entries section.
Start by opening the file /etc/sudoers using below command:

$ sudo visudo

Go to the defaults section and add the following line:

 Defaults insults

Below is a sample of /etc/sudoers file on my system showing defaults entries:

1
From the screenshot above, you can see that there are many other defaults defined such as send mail to root when each time a user enters a bad password, set a secure path, configure a custom sudo log file and more. Save the file and close it. Open a new terminal window and run any command with sudo and type a wrong password.
Here i’m running

sudo apt-get update

2
When you configure the insults parameter, it disables the badpass_message parameter which prints a specific message on the command line (the default message is “sorry, try again”) in case a user enters a wrong password.

To modify the message, add the badpass_message parameter to the /etc/sudoers file as shown below.

4

Save the file and close it, then invoke sudo and see how it works, the message you set as the value of badpass_message will be printed every time you or any system user types a wrong password.

3

 

Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 13 Sep, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads