How to customize your sudo password prompt

Read Time:1 Minute, 53 Second

If you’re looking for a way to easily warn your admins to use caution when working with sudo, Jack Wallen has a sure-fire method.

You probably have a number of admins who work on your Linux servers. In order to actually get anything done, those admins most likely have to make use of sudo. As you are probably well aware, with the help of sudo any number of things can be done to your servers. Because of that, you might want to make sure your admins use sudo with caution. 

One way to do that is to customize the sudo password prompt. So instead of sudo just asking for the admin’s password, it’ll also warn them to use caution. Let’s say, for example, when you have a user working with sudo, you want the password prompt to say “PROCEED WITH CAUTION…PASSWORD:” 

SEE: Linux file and directory management commands (TechRepublic Premium)

You can make that configuration change with a single quick command. When complete, anytime a user issues a command with sudo, they’ll be presented with that warning. 

To do this, open a terminal window and set the custom prompt with the command:

export SUDO_PROMPT="Custom Prompt"

Custom Prompt is the text string you want to use for the sudo warning. Following our example above, that command would be: 

export SUDO_PROMPT="PROCEED WITH CAUTION...PASSWORD:"

Once you’ve done this, a user will see that warning whenever they use sudo. If you ever decide to change that, you can simply re-run the command with a different string for the custom prompt. If you want to reset it back to the default, run the command:

unset SUDO_PROMPT

 And that’s all there is to customizing your sudo password prompt. This is a very easy way to remind your administrators to use caution when working with sudo. After all, you don’t want to have to undo mistakes on this level. 

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

Also see

linuxadminhero.jpg

Image: Jack Wallen

About Post Author

admin

Founder, The Internet Crime Fighters Org [ICFO], and Sponsor, ICFO's War On Crimes Against Our Children Author The Internet Users Handbook, 2009-2014
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleppy
Sleppy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

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

%d bloggers like this: