When sudo insults you!!

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:

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

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.


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.



This article is contributed by Saket Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

GATE CS Corner    Company Wise Coding Practice

Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.