Home > Article > System Tutorial > Customize the mocking information of the sudo command when entering an incorrect password
Introduction | sudoers is the default sudo security policy plug-in in Linux, but experienced system administrators can customize security policies and input and output logging plug-ins. It is driven by the file /etc/sudoers, or it can be in LDAP. |
You can define sudoers mocking or other options in the file above. It is set under the defaults section.
In this article, we will explain a sudoers configuration parameter to allow individuals or system administrators to set up sudo commands that "taunt" system users when they enter incorrect passwords.
First open the file /etc/sudoers as shown below:
$ sudo visudo
Go into the defaults section and add the following lines:
Defaults insults
The following is the defaults section that is displayed by default in /etc/sudoers in my system.
Set sudo insults parameters
From the screenshot above, you can see that there are many other default value definitions in defaults, such as sending an email to root every time the user enters a wrong password, setting a safe path, configuring Define sudo log files, etc.
Save and close the file.
Run the sudo command with the wrong password and observe how the insults option works:
$ sudo visudo
Practice sudo insult
Note: When configuring the insights parameter, it will disable the badpass_message parameter, which will output a specific message on the command line when the user enters an incorrect password (default The message is "sorry, try again").
To modify the message, add the badpass_message parameter to the /etc/sudoers file as shown below.
Defaults badpass_message="Password is wrong, please try again" #try to set a message of your own
Set sudo incorrect password message
Save and close the file, then call sudo To see how it works, the badpass_message message you set will be displayed every time you or any system user enters an incorrect password. print it out.
$ sudo visudo
sudo password error message
That's it, in this article we review how to set sudo to display a mock when the user enters the wrong password. Please share your thoughts via the comment box below.
About the Author:
Aaron Kili is a Linux and F.O.S.S enthusiast, future Linux SysAdmin, web developer, and currently a content creator at TecMint who loves working with computers and believes in sharing knowledge.
The above is the detailed content of Customize the mocking information of the sudo command when entering an incorrect password. For more information, please follow other related articles on the PHP Chinese website!