How to change the message to ask for the sudo password

Prompt

Linux allows the maximum possible customization, from changing the wallpaper to changing the kernel messages. This is something that many users appreciate and prefer because with little effort we can have a unique and highly secure operating system.

Next we are going to explain how to change sudo password prompt. If that message that appears after typing the sudo command and where we are asked to enter the administrator password.

In order to modify the sudo password request message we can do it in two ways: the first one is through editing sudoers file, a somewhat difficult method since it is a delicate file of the operating system; the second method is via a command that writes to the sudo config files.

The sudo command prompt can be quickly customized on any Gnu / Linux distribution

If we choose to edit the sudoers file, we open a terminal and type the following:

visudo

And we write the following code at the end of the file:

defaults passprompt="Mensaje que queramos introducir como nuevo texto"

After saving the changes, after writing sudo in the terminal, the message that we have entered as standard in the previous code will appear. But there is another way that is faster and safer, this is done through the export command. If we want to customize the sudo password request message, we have to use the following code on the command line as administrator:

export SUDO_PROMPT='Hola, puede introducir la contraseña de Administrador?:'

But there is more, this command allows us to introduce icons in the message, if ASCII icons, but icons after all. This can be done like this:

export SUDO_PROMPT='[sudo] %p : '

It can also be done by inserting the code of the icon but it is best to copy and paste, faster and easier if you do not know the ASCII codes. As you can see, the customization in Linux is very high, to the point of being able to change messages as common and popular as these.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Fyodor said

    r: -m First of all, I would say that the password that sudo asks for is not the administrator's but the user's own. And secondly, it seems dangerous to me because, although I suppose that the configuration file will not be accessible to ordinary mortals, the export command is, and this opens the door to social engineering a little more.