Bug 836

Summary: Give hint who (sudo) asks for password entry
Product: Sudo Reporter: m1027
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED WORKSFORME    
Severity: low    
Priority: low    
Version: 1.8.22   
Hardware: PC   
OS: Linux   

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.