303-300 · Question #5
What is the difference between a SetUID and SetGID bit?
The correct answer is B. SetUID allows a file to be executed with the permissions of the file owner, while SetGID allows a. SetUID (Set User ID) and SetGID (Set Group ID) are special permission bits in Unix/Linux that change whose privileges are used during execution. Option B is correct because SetUID causes an executable to run with the file owner's permissions (not the caller's), while SetGID…
Question
What is the difference between a SetUID and SetGID bit?
Options
- ASetUID applies to files, while SetGID applies to directories
- BSetUID allows a file to be executed with the permissions of the file owner, while SetGID allows a
- CSetUID allows a user to change the owner of a file, while SetGID allows a user to change the
- DThere is no difference between SetUID and SetGID
How the community answered
(60 responses)- A8% (5)
- B87% (52)
- C3% (2)
- D2% (1)
Explanation
SetUID (Set User ID) and SetGID (Set Group ID) are special permission bits in Unix/Linux that change whose privileges are used during execution. Option B is correct because SetUID causes an executable to run with the file owner's permissions (not the caller's), while SetGID causes it to run with the file's group permissions - the classic example being passwd, which runs as root regardless of who invokes it.
Why the distractors are wrong:
- A is false - both bits apply to both files and directories (on directories, SetGID makes new files inherit the directory's group, which is a distinct but real use case).
- C describes
chown/chgrpfunctionality, not SetUID/SetGID at all - these bits have nothing to do with changing ownership. - D is obviously false; they differ in which identity is assumed (owner vs. group).
Memory tip: Think of the letters - UID = User (owner), GID = Group. Both "set" a temporary identity for execution, just at different levels of the permission hierarchy.
Topics
Community Discussion
No community discussion yet for this question.