Special Permissions (SetUID, SetGID, Sticky Bit)/shaare/cb3cog
chmod u+s xyz.sh→ add SetUID (user-level special permission)chmod g+s xyz.sh→ add SetGID (group-level special permission)chmod u-s xyz.sh→ remove SetUIDchmod g-s xyz.sh→ remove SetGIDfind / -perm /6000 -type f→ find all executables with SetUID/SetGID
⚠️ SetUID/SetGID works only for C/C++ compiled binaries, not Bash scripts.
Sticky Bit
- Protects files from deletion by non-owners
- Example:
ls /→ shows sticky bit astinrwxrwxrwt -
chmod +t file/dir→ assign sticky bit- Only the creator can delete contents of that folder, even with full permissions
(19)