Bug 836 - Give hint who (sudo) asks for password entry
Give hint who (sudo) asks for password entry
Status: RESOLVED WORKSFORME
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.22
PC Linux
: low low
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-05-31 01:39 MDT by m1027
Modified: 2018-05-31 15:39 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description m1027 2018-05-31 01:39:23 MDT
When I execute e.g. a mount command over sudo I might by queried for two
passwords one after the other: First for sudo, then for mount (eg cifs mount
with password).

While cifs-mount (as well as cryptsetup and others) give a context hint who is
asking for the password or for what purpose, sudo does not.

So, I often have to think twice what password to enter:

me@home ~ $ sudo mount /mnt/cifs-share/
Password:   <------- NO CONTEXT HINT GIVEN BY SUDO
Password for me@//myserver/share:  ********

To make it more clear, something like this would be nice to have:

me@home ~ $ sudo mount /mnt/cifs-share/
Password for sudo:
Password for me@//myserver/share:  ********

Thanks
Comment 1 Todd C. Miller 2018-05-31 15:39:09 MDT
You can set the sudo prompt in two ways.

1) In the sudoers file.  For example, the following line will change the prompt to:
    [sudo] password for username:

Defaults passprompt = "[sudo] password for %p: "

2) By setting the SUDO_PROMPT environment variable.

See the sudoers manual for more information on passprompt and the escapes it supports.