Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 297823 - Sudo should prompt for password with a more detailed prompt
Summary: Sudo should prompt for password with a more detailed prompt
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-21 18:56 UTC by Jeff Hansen
Modified: 2009-12-22 22:30 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Hansen 2009-12-21 18:56:12 UTC
I noticed in the latest Ubuntu that their sudo now prompts for a password like so:

[sudo] password for username:

Instead of gentoo sudo's simple:

Password:

I think Gentoo should copy Ubuntu's behavior, because there are particular cases where this could be catastrophic, causing password information to be leaked.  One that I have actually been bitten by before is this:

# sudo mount -t cifs //1.2.3.4/smb /mnt/smb -o username=username
Password: ***

It only asked me for the password once, so I typed my username's password first, assuming that it was sudo asking for me user's password.  Unfortunately, it was actually mount.cifs asking for the Samba password, and so the Samba administrator could potentially have gotten my local machine's user password because the sudo prompt is the same for both programs.

I realize that Samba has challenge/response auth, so in this particular case I am probably safe, but that's the besides the point.  I still think the sudo password prompt should be slightly more descriptive, and this would be really easy to fix.


Reproducible: Always

Steps to Reproduce:
1. sudo

Actual Results:  
Password: 

Expected Results:  
[sudo] Password for username:
Comment 1 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-12-21 19:11:20 UTC
From the sudo man page:
       -p prompt   The -p (prompt) option allows you to override the default
                   password prompt and use a custom one.  The following
                   percent (`%') escapes are supported:

                   %H  expanded to the local hostname including the domain
                       name (on if the machine's hostname is fully qualified
                       or the fqdn sudoers option is set)

                   %h  expanded to the local hostname without the domain name

                   %p  expanded to the user whose password is being asked for
                       (respects the rootpw, targetpw and runaspw flags in
                       sudoers)

                   %U  expanded to the login name of the user the command will
                       be run as (defaults to root)

                   %u  expanded to the invoking user's login name

                   %%  two consecutive % characters are collapsed into a
                       single % character

                   The prompt specified by the -p option will override the
                   system password prompt on systems that support PAM unless
                   the passprompt_override flag is disabled in sudoers.

So, make an alias in your .bashrc:
%% sudo -p "[sudo] password for %p: " bash
[sudo] password for my_user:
%%
Comment 2 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-12-22 22:30:56 UTC
Closing as WONTFIX.

In your particular case, *you* set sudo not to ask you a password, which among other things is not the default configuration.

And as Jeremy pointed out, it's user configurable.