When we access file, file permission is checked from effective user ID of process. But, how about changing user ID like setuid(), setreuid(), seteid().

On these functions, superuser privilege is also checked from effective user ID(effective user ID is root) of process calling these functions?

  • 1
    Yes, "superuser privilege" is equivalent to having an effective user ID of 0 (root); although some versions of Linux support finer-grained privileges.  Is that what you wanted to know? – G-Man Says 'Reinstate Monica' Mar 6 '16 at 8:48

The expression “have superuser privileges” can mean different things. You need to look at the context.

In a system administration context, “have superuser privileges” usually means a user who is allowed to access the root account, for example because they are authorized via the sudo configuration, or because they know the root password.

In a programming context, “have superuser privileges” usually means a process that is running with UID 0. If it is stated at a point in time, e.g. when discussing whether a system call is authorized, it usually means that the effective UID is 0 for most system calls. If it is state in a timeless way, it usually means that the process is able to set its effective UID to 0, which also includes processes whose real or saved user UID is 0.

If you want to know what the exact requirements are for a particular function, check the documentation of this function on your system (there are variations depending on the underlying kernel).

TL,DR: context matters.

| improve this answer | |

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.