LX0-103 · Question #66
What do the permissions -rwSr-xr-x mean for a binary file when it is executed as a command?
The correct answer is C. The execute flag is not set for the owner. Therefore the SetUID flag is ignored. The uppercase S in the owner execute position of -rwSr-xr-x means SetUID is set but the owner execute bit is absent, so the kernel ignores SetUID entirely.
Question
What do the permissions -rwSr-xr-x mean for a binary file when it is executed as a command?
Options
- AThe command is SetUID and it will be executed with the effective rights of the owner.
- BThe command will be executed with the effective rights of the group instead of the owner.
- CThe execute flag is not set for the owner. Therefore the SetUID flag is ignored.
- DThe command will be executed with the effective rights of the owner and group.
How the community answered
(70 responses)- A11% (8)
- B4% (3)
- C64% (45)
- D20% (14)
Why each option
The uppercase `S` in the owner execute position of `-rwSr-xr-x` means SetUID is set but the owner execute bit is absent, so the kernel ignores SetUID entirely.
Execution with the owner's effective rights via SetUID requires a lowercase `s` in the owner execute field, meaning both SetUID and execute are set; the uppercase `S` here negates that behavior.
Execution with the group's effective rights is controlled by the SetGID bit, which appears in the group execute position, not the owner execute position shown here.
Unix encodes SetUID in the owner execute slot as lowercase `s` when the execute bit is also set, and as uppercase `S` when the execute bit is missing. Because the owner has no execute permission here, the kernel cannot launch the process in an elevated context, and the SetUID flag has no effect - the binary simply cannot be run with elevated owner rights.
No standard Unix permission bit simultaneously grants both owner and group effective rights; SetUID and SetGID are independent bits affecting different privilege contexts.
Concept tested: SetUID bit with missing owner execute permission
Source: https://www.gnu.org/software/coreutils/manual/html_node/Setting-Permissions.html
Topics
Community Discussion
No community discussion yet for this question.