Run a binary with the set-user-ID bit on a normal Linux system.
Assume no_new_privs, nosuid, ptrace, or other conditions that disable setuid.
What changes in the process?
For a valid setuid binary, the process effective user ID becomes the executable file owner's ID. The real user ID remains the invoking user's ID.
Detailed explanation
Incorrect. Executing a file does not change the file's owner.
Incorrect. Executing a file does not change the file's owner.
Incorrect. The effective UID becomes the file owner's UID, which is not necessarily root.
Incorrect. The effective UID becomes the file owner's UID, which is not necessarily root.
Incorrect. setuid changes the effective user ID, not only the group ID.
Incorrect. setuid changes the effective user ID, not only the group ID.
Correct. The effective UID becomes the executable's owner UID.
Correct. The effective UID becomes the executable's owner UID.
Try it yourself
An example you can run in a temporary verification environment.
man 2 execveExpected result
set-user-IDファイル実行時のeffective user IDの説明Key points
- The effective UID changes
- It becomes the file owner's UID
- Conditions can disable setuid
Notes
- Environment: Linux man-pages 6.x
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.