- If the process has superuser privileges, the setuid function sets the real user ID, effective user ID, and saved set-user-ID to uid.
- If the process does not have superuser privileges, but uid equals either the real user ID or the saved set-user-ID, setuid sets only the effective user ID to uid. The real user ID and the saved set-user-ID are not changed.
- If neither of these two conditions is true, errno is set to EPERM and −1 is returned.
What does "a process have superuser privileges" mean?
Does it mean the real user of the process have ID 0 i.e. being root?
Does it mean the effective user of the process have ID 0 i.e. being root?