Study guide
8.4 Special Permissions: SUID, SGID & Sticky Bit (104.5)
LPIC-1 Linux Administrator — Exam 101 101-500
Track your progress as you read
Finished sections get a check mark.
1 Exam Overview & Study Strategy
1.1 LPIC-1 101-500 Exam Structure & Blueprint 1.2 Command Line & Shell Fundamentals for Exam Success 1.3 Fill-in-the-Blank Strategies & Common Traps
2 Topic 101: System Architecture
2.1 Hardware Discovery, Sysfs, Procfs & Kernel Modules (101.1) 2.2 Udev, Dbus & Device Management (101.1) 2.3 BIOS vs. UEFI & System Boot Process (101.2) 2.4 Kernel Initialization, Initramfs & System Logs (101.2) 2.5 Systemd Boot Targets & Unit Management (101.3) 2.6 SysVinit Runlevels, Telinit & System Shutdown (101.3)
3 Topic 102: Linux Installation & Boot Management
3.1 Hard Disk Layout, Partition Schemes & Swap Design (102.1) 3.2 LVM & Standard Mount Point Allocation (102.1) 3.3 GRUB 2 Configuration & Troubleshooting (102.2) 3.4 Legacy GRUB & Alternative Boot Loaders (102.2) 3.5 Managing Shared Libraries & ldconfig (102.3) 3.6 Linux as a Virtualization Guest & Cloud Instances (102.6)
4 Topic 102: Package Management Systems
4.1 Debian Low-Level Package Management with dpkg (102.4) 4.2 High-Level Debian Package Management: apt, apt-get & apt-cache (102.4) 4.3 RPM Package Management with rpm (102.5) 4.4 YUM, DNF & Zypper Package Management (102.5) 4.5 Package Repositories & Integrity Verification (102.4/102.5) 4.6 Universal Linux Packages: Snap, Flatpak & AppImage (102.4/102.5)
5 Topic 103: Command Line & Text Processing
5.1 Shell Environment, Environment Variables & Aliases (103.1) 5.2 Command History, Quoting & Expansion (103.1) 5.3 Basic Text Filters: cat, head, tail, cut, paste, nl, od (103.2) 5.4 Advanced Text Filters: sort, uniq, wc, tr, split, less & Checksums (103.2) 5.5 Stream Editing with sed (103.2) 5.6 Basic File Management: cp, mv, rm, touch, mkdir, rmdir (103.3) 5.7 Archiving and Compression: tar, gzip, bzip2, xz, cpio & dd (103.3)
6 Topic 103: Streams, Processes, Regex & Vi
6.1 Standard Streams, Redirection & File Descriptors (103.4) 6.2 Pipelines, tee & xargs (103.4) 6.3 Process Monitoring: ps, top, free, watch, pgrep, pstree & uptime (103.5) 6.4 Signals, kill, Job Control, nohup, screen & tmux (103.5) 6.5 Process Priorities: nice & renice (103.6) 6.6 Regular Expressions & grep, egrep, fgrep (103.7) 6.7 vi / vim Modes, plus nano, Emacs & EDITOR Awareness (103.8)
7 Topic 104: Devices, Partitions & Filesystems
7.1 Block Devices, fdisk & gdisk (104.1) 7.2 GNU Parted & Partition Table Management (104.1) 7.3 Creating Filesystems: mkfs, ext4, XFS, VFAT/exFAT & Btrfs (104.1) 7.4 Filesystem Integrity: fsck, e2fsck, xfs_repair, xfs_fsr & xfs_db (104.2) 7.5 Monitoring Disk Usage: df, du & tune2fs (104.2) 7.6 Managing Swap Space: mkswap, swapon & swapoff (104.1/104.2)
8 Topic 104: Mounts, Permissions, Links & FHS
8.1 Mounting and Unmounting Filesystems: mount & umount (104.3) 8.2 Persistent Mounts: /etc/fstab, UUIDs & systemd mount units (104.3) 8.3 Standard File Permissions: chmod, chown, chgrp & umask (104.5) 8.4 Special Permissions: SUID, SGID & Sticky Bit (104.5) 8.5 Hard Links vs. Symbolic Links: ln & Inodes (104.6) 8.6 Filesystem Hierarchy Standard (FHS) & File Location (104.7)
8.4 Special Permissions: SUID, SGID & Sticky Bit (104.5)
Key Takeaways Explain This Topic AI
Linux defines three special permission bits that precede standard permissions: Set-User-ID (SUID, octal 4000 ), Set-Group-ID (SGID, octal 2000 ), and the Sticky Bit (octal 1000 ).
SUID ( u+s / 4000 ) on an executable binary runs the process with the effective permissions of the file owner (e.g., /usr/bin/passwd running as root); it displays as s in the owner execute position, or S if the execute bit is missing.
SGID ( g+s / 2000 ) on a directory enforces group collaboration: newly created files and subdirectories automatically inherit the parent directory's group ownership and SGID bit.
The Sticky Bit ( +t / o+t / 1000 ) on shared directories (e.g., /tmp mode 1777 ) prevents users from deleting or renaming files owned by others; only the file owner, directory owner, or root can delete files.
Special permissions are audited across the filesystem using find / -perm -4000 , find / -perm -2000 , find / -perm -1000 , or find / -perm /6000 .
Last updated: August 2026
8.4 Special Permissions: SUID, SGID & Sticky Bit
Quick Summary: While standard Discretionary Access Control (DAC) covers basic read, write, and execute permissions, multi-user Linux environments require advanced permission mechanics. Linux provides three Special Permission Bits : Set-User-ID (SUID) , which allows executable binaries to run with the privileges of the file owner; Set-Group-ID (SGID) , which allows binaries to run with group privileges and forces directory inheritance for team collaboration; and the Sticky Bit (Restricted Deletion Flag) , which prevents users from deleting each other's files in public directories like /tmp . On the LPIC-1 exam, understanding their octal values ( 4000 , 2000 , 1000 ), symbolic representations ( s / S , t / T ), and auditing with find is critical.
1. Architecture of Special Permission Bits
In full 4-digit octal notation, the leading digit represents the special permission flags, followed by User, Group, and Others: Mode Format = [ Special ] [ User ] [ Group ] [ Others ] \text{Mode Format} = [\text{Special}][\text{User}][\text{Group}][\text{Others}] Mode Format = [ Special ] [ User ] [ Group ] [ Others ] Special Bits Value Breakdown:
- ┌───────────────────────────────────────────────┐
- │ Octal Value │ Flag Name │ Symbolic Representation │
- ├─────────────┼────────────┼─────────────────────────┤
- │ 4000 │ SUID │ u+s (in owner position) │
- │ 2000 │ SGID │ g+s (in group position) │
- │ 1000 │ Sticky Bit │ +t (in others position)│
- └───────────────────────────────────────────────┘
- 2. SUID (Set User ID — Octal 4000 / u+s )
- Mechanics on Executable Binaries
Normally, when a user executes a program, the newly spawned process inherits the Real UID and Effective UID of the calling user. When the SUID bit is set on an executable binary, the kernel assigns the process an Effective UID equal to the file's owner , rather than the user who executed it. # Inspecting /usr/bin/passwd:
- $ ls -l /usr/bin/passwd
- rwsr-xr-x 1 root root 68208 Aug 29 10:00 /usr/bin/passwd
The /usr/bin/passwd command is owned by root and has SUID ( rws ) enabled.
When an unprivileged user executes passwd to change their password, the process executes with effective root privileges.
This allows the program to modify the protected /etc/shadow file, which regular users cannot write to directly.
Lowercase s vs. Uppercase S in SUID
Character Meaning Technical Explanation
s (lowercase) SUID Active + Execute ( x ) Set The SUID bit is active AND the user owner execute bit ( x ) is set (e.g., rwsr-xr-x / 4755 ). Normal executable state.
S (uppercase) SUID Active + Execute ( x ) Missing The SUID bit is active, but the user owner execute bit ( x ) is NOT set (e.g., rwSr-xr-x / 4655 ). Indicates a misconfiguration or non-executable file.
⚠️ LPIC-1 Trap — Shell Scripts and SUID: In modern Linux, the kernel ignores the SUID bit on interpreted shell scripts (such as Bash, Perl, or Python scripts) due to severe security race conditions ( /dev/fd spoofing). SUID is honored only on compiled ELF binary executables. Furthermore, mounting a filesystem with -o nosuid disables all SUID execution on that partition.
- 3. SGID (Set Group ID — Octal 2000 / g+s )
- 1. SGID on Executable Binaries
Similar to SUID, an executable binary with SGID executes with the Effective Group ID (EGID) of the file's group owner, granting the process access to group-restricted files or hardware (e.g., /usr/bin/wall running with tty group privileges).
2. SGID on Collaborative Directories (Exam Hotspot)
In shared team environments, multiple users need to collaborate within a common directory. By default, when a user creates a new file, it belongs to that user's primary group, preventing teammates from modifying it.
When the SGID bit is applied to a directory ( chmod g+s or chmod 2775 ):
Any new file created inside the directory automatically inherits the Group Owner of the parent directory , rather than the primary group of the creating user.
Any new subdirectory created inside automatically inherits both the parent's group owner and the SGID bit . # Creating a collaborative shared team directory:
- $ sudo mkdir /srv/devteam
- $ sudo chown :developers /srv/devteam
- $ sudo chmod 2775 /srv/devteam
# Verification of directory permissions:
- $ ls -ld /srv/devteam
- drwxrwsr-x 2 root developers 4096 Aug 29 10:00 /srv/devteam
- Lowercase s vs. Uppercase S in SGID
s (lowercase): SGID bit is set AND group execute ( x ) is enabled ( rwxrwsr-x / 2775 ).
S (uppercase): SGID bit is set, but group execute ( x ) is disabled ( rwxrWsr-x / 2765 ).
- 4. The Sticky Bit (Restricted Deletion — Octal 1000 / +t / o+t )
- Mechanics on Public Directories
In public multi-user directories like /tmp and /var/tmp , all system users require write ( w ) and execute ( x ) permissions to create temporary working files (mode 777 ). However, standard DAC rules would permit any user to delete or rename any other user's files.
The Sticky Bit (restricted deletion flag) solves this vulnerability. When set on a directory:
Users can still create files freely.
A file inside the directory can ONLY be deleted or renamed by:
The User Owner of the file .
The Owner of the directory (typically root ).
The Root superuser . # Inspecting /tmp:
- $ ls -ld /tmp
- drwxrwxrwt 18 root root 4096 Aug 29 10:00 /tmp
- Lowercase t vs. Uppercase T in Sticky Bit
t (lowercase): Sticky bit is set AND others execute ( x ) is enabled ( rwxrwxrwt / 1777 ).
T (uppercase): Sticky bit is set, but others execute ( x ) is disabled ( rwxrwxrwT / 1776 ).
- 5. Practical Configuration & Special Permission Auditing
- Setting Special Permissions via chmod
- Goal Symbolic Command Numeric (Octal) Command
- Add SUID to a binary chmod u+s /usr/local/bin/custom_tool chmod 4755 /usr/local/bin/custom_tool
- Add SGID to a shared directory chmod g+s /srv/shared chmod 2775 /srv/shared
- Add Sticky Bit to a directory chmod +t /srv/public_drop chmod 1777 /srv/public_drop
- Enable both SGID and Sticky Bit chmod g+s,o+t /srv/collab chmod 3777 /srv/collab (2000 + 1000 = 3000)
- Auditing Special Permissions with find
Auditing SUID and SGID files is a crucial security maintenance task tested heavily on the LPIC-1 exam: # 1. Find all files with SUID bit set (-perm -4000):
$ sudo find / -type f -perm -4000 -ls 2>/dev/null
# 2. Find all files with SGID bit set (-perm -2000):
$ sudo find / -type f -perm -2000 -ls 2>/dev/null
# 3. Find all directories with the Sticky Bit set (-perm -1000):
$ sudo find / -type d -perm -1000 -ls 2>/dev/null
# 4. Find all files with EITHER SUID or SGID set (-perm /6000 or -perm /u=s,g=s):
$ sudo find / -type f -perm /6000 2>/dev/null
💡 LPIC-1 Exam Fill-in-the-Blank Alert: What find argument syntax searches for all files that have at least the SUID permission bit set, regardless of what other permissions are enabled? Answer: -perm -4000 (or -perm /4000 )