Does su always change ruid, euid and suid to the same user id, or just some of them?

I feel all of them, because the process which is executing su is always run with superuser privileges, and in which case, setuid() sets all three kinds of user ids to the same value.


1 Answer 1


Yes: as you say, su runs with superuser privileges, so setuid sets all three user ids.

As explained in the rationale in the POSIX spec for setuid, this behaviour is necessary: otherwise the process started by su would be able to setuid back to the original user, which is not desirable.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .