Intermediate LevelLinux Commands & SysAdmin
What are Special Permissions: SUID (4000), SGID (2000), and Sticky Bit (1000)?
❓ Interview Prompt: Explain special permissions: SUID (chmod u+s / 4000), SGID (chmod g+s / 2000), Sticky Bit (chmod +t / 1000 on /tmp), and security implications.
Beyond standard rwx permissions, Linux provides three Special Permission Bits:
1
SUID (Set User ID - 4000 / 'u+s'): Executable runs with the file owner's privileges rather than the executing user (e.g. '/usr/bin/passwd').
2
SGID (Set Group ID - 2000 / 'g+s'): Executable runs with file group privileges. On directories, new files inherit parent directory group!
3
Sticky Bit (1000 / '+t'): On directories (e.g. '/tmp'), prevents users from deleting or renaming files owned by others!
Code Implementation Example
bash
# Apply Sticky Bit to shared directory (+t)
sudo chmod +t /var/shared-tmp/
# Apply SGID to directory so new files inherit group
sudo chmod g+s /var/www/project/
# Inspect special permissions (t = sticky, s = SUID/SGID)
ls -ld /tmp /var/www/project/💡Configuring Sticky Bit and SGID special permissions on directories.
🎯 Interview Key Takeaway
Use SGID (g+s) on shared group folders so new files inherit group ownership, and Sticky Bit (+t) on public temporary folders.
#Special Permissions#SUID#SGID#Sticky Bit#Intermediate
Back to all Linux Commands & SysAdmin Questions→