Bug 221264 - security/sudo: add passprompt example to ask for "root's password:" when using targetpw
Summary: security/sudo: add passprompt example to ask for "root's password:" when usin...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Renato Botelho
URL:
Keywords: easy, needs-patch
Depends on:
Blocks:
 
Reported: 2017-08-06 02:08 UTC by Rebecca Cran
Modified: 2018-04-19 13:11 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (garga)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rebecca Cran freebsd_committer freebsd_triage 2017-08-06 02:08:35 UTC
There's an example in the default sudoers file for having sudo ask for the target user's password instead of the current user's:

Defaults targetpw  # Ask for the password of the target user

I like the way OpenSUSE handles this, in that it changes the password prompt to make it clear that you should enter root's password and not your own.

I think it would be nice if the example had the following additional line:

Defaults passprompt="%U's password:"
Comment 1 Renato Botelho freebsd_committer freebsd_triage 2018-04-19 11:15:00 UTC
(In reply to Rebecca Cran from comment #0)
%U always expands to target user, %u to invoking's user and I found %p is the desired macro to be used here since it expands always to the user password is being required. Respecting targetpw, rootpw or runaspw. I'll add it to sudoers template
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-04-19 13:10:06 UTC
A commit references this bug:

Author: garga
Date: Thu Apr 19 13:09:58 UTC 2018
New revision: 467767
URL: https://svnweb.freebsd.org/changeset/ports/467767

Log:
  Add an example of prompt that shows which user password is being expected.
  It's useful when targetpw option is set to avoid confusion. PORTREVISION was
  not bumped because a new commit is going to happen soon with one more change
  and it will bump it.

  PR:		221264
  Submitted by:	Rebecca Cran <rebecca@bluestop.org>
  Sponsored by:	Rubicon Communications, LLC (Netgate)

Changes:
  head/security/sudo/files/patch-plugins__sudoers__sudoers.in