If a server has the following in /etc/sudoers:

Defaults targetpw

Then what does this mean? all the users can sudo to all the commands, only their password is needed?

  • 11
    It means "security Nirvana", that's what it means. ;)
    – lcd047
    May 6 '15 at 20:51
  • In Ubuntu 20.04.1 LTS I saw like this ALL=(ALL:ALL) ALL two ALL s together `
    – Arun
    Feb 24 '21 at 10:58

From the sudoers(5) man page:

The sudoers policy plugin determines a user's sudo privileges.

For the targetpw:

sudo will prompt for the password of the user specified by the -u option (defaults to root) instead of the password of the invoking user when running a command or editing a file.

sudo(8) allows you to execute commands as someone else

So, basically it says that any user can run any command on any host as any user and yes, the user just has to authenticate, but with the password of the other user, in order to run anything.

The first ALL is the users allowed
The second one is the hosts
The third one is the user as you are running the command
The last one is the commands allowed
  • Thanks! In the meantime I found the "Defaults targetpw" entry in sudoers.. updated the Q May 7 '15 at 16:37
  • @LoukiosValentine79 I just update the answer, does that answer your question?
    – poz2k4444
    May 7 '15 at 18:24
  • wait he has to enter his own password not of the other user right?
    – evan54
    Feb 28 '16 at 20:24
  • 1
    with targetpw the one of the other (target) user
    – x-yuri
    May 19 '17 at 12:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.