0

From man sudo

-P, --preserve-groups

Preserve the invoking user's group vector unaltered. By default, the sudoers policy will initialize the group vector to the list of groups the target user is a member of. The real and effective group IDs, however, are still set to match the target user.

What is the "group vector" of a user? I couldn't find its definition by Google. Thanks.

2

Group vector is a term that refers to the specific set of groups to which a user has membership.

Basically, whatever commands that are run using sudo will be run with the effective user and group IDs of the target user.

  • Thanks. What does "vector" mean? – Tim Apr 27 '18 at 2:50
  • vector is a fancy word for collection or list. – Miguel Mota Apr 27 '18 at 2:52
  • Is there really a collection or list such as a bit array somewhere for the groups of a user? – Tim Apr 27 '18 at 2:54
  • /etc/group contains all group ids (gids) and /etc/passwd contains the user gids – Miguel Mota Apr 27 '18 at 3:04
  • 1
    passwd contains the primary groupid for each user (which was the only one in olden days); group contains for each group (and groupid) all usernames that have that group as a secondary group, so this information must be 'reversed' to determine the secondary group(id)s for a given user. – dave_thompson_085 Apr 27 '18 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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