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:
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.
This post was written by and was first posted to TechRepublic
Do you find this article helpful? Your Friend might too. So, please Share it with them using the Share button above.
Will you like to get notified when I post new updates? Then Follow me on any of my social media handles: Google News, Telegram, WhatsApp, Twitter, Facebook, Pinterest.
You can also drop your email address below if you wish to be notified by mail.