1
  1. From man sudo

    When sudo executes a command, the security policy specifies the execution environment for the command. Typically, the real and effective user and group and IDs are set to match those of the target user, as specified in the password database, and the group vector is initialized based on the group database (unless the -P option was specified).

    Why does sudo change both effective and real user/group IDs to those of the target user, instead of just effective user/group IDs?

    Are effective user/group IDs not the only ones needed to take on the privileges of the target user?

  2. From https://unix.stackexchange.com/a/333245/674

    changing the effective user and group ID's of a process is only one way of changing the privileges of a process, the security policy defined in sudo.conf can use any other kind of parameters in the above list.

    In order to change the privileges, are there other ways than changing the effective user/group IDs? What are they?

Thanks.

My question is inspired from Does `sudo` work in terms of changing the effective user and group IDs of a process?

5
  1. sudo changes both the real and effective user ids in order to restrict the resulting process’ privileges. Changing the effective id is sufficient to grant the new process the privileges of the requested user, but doing only that leaves open a gaping hole: setuid can then be used to assume the privileges of the calling user. To avoid that, sudo sets the real user id too.

  2. The list of possibilities is given in the sudo manpage and quoted in the answer you’re referring to. Some of those have an impact on the child process’ privileges: the SELinux role and type, the Solaris project and privileges, and the BSD login class.

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.