Saturday, July 9, 2022

[SOLVED] Does setuid set the effective uid to root, or the owner's uid?

Issue

I need help understanding the setuid mechanism. I understand that it allows you to give someone privilege/rights higher than what you really are, when executing the program.

But so far what I've been learning is that they are given 'root'. I'm not sure if setuid always makes the effective uid to be root, or the file owner as the effective uid?

For example, given this:

-r-s---r-x 1 alice group1 date file1

If alice executes file1, I assume the real uid would be alice but I am not sure whether the effective uid will be 'root' or 'alice' (who owns the file).

My lecture slides always claim setuid to be giving 'root' permissions so I am a little unclear.


Solution

SUID give owner permission to the user execution the file. So in your case if user exec file it will have UID of alice



Answered By - Romeo Ninov
Answer Checked By - Willingham (WPSolving Volunteer)