How to set a message for the sudo login prompt

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux
  • Sudo

Issue

We would like to modify the default message a user receives for the password prompt when trying to use sudo:

 # sudo su -
With great power comes great responsibility.
Please enter your password: 

Resolution

To set a default prompt message, add an entry like the following example to the /etc/sudoers file.

 # visudo
 Defaults passprompt="With great power comes great responsibility.
Please enter your password:  "

Root Cause

Sudo has a preset default password prompt, which can be edited.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments