Skip to main content
Standard Linux file permissions cover read, write, and execute. In addition, three special permission bits alter how the system applies privileges, how group ownership is inherited, or who can delete files in shared directories. These special bits do not directly grant or deny access; instead, they change behavior and enforce collaboration rules. This guide explains:
  • what SUID, SGID, and the sticky bit do,
  • practical use cases (especially for shared directories),
  • commands to configure and verify them,
  • a real-world SUID example (the passwd command).
A dark-themed slide titled "Special Permissions" with the subtitle "Special rules in a shared workspace." Three circular icons across the center illustrate: temporarily elevate user authority; enforce shared team ownership; and protect shared areas for safe collaboration.
Special permissions modify behavior rather than typical access. Use them intentionally—especially SUID—because they affect security boundaries.

At a glance: What each special bit does

Permission bit notation quick reference

  • The s character appears in place of an x when SUID or SGID is set and the execute bit is present (e.g., rws).
  • An uppercase S or T indicates the special bit is set but the corresponding execute bit is not set.
  • Use chmod with numeric or symbolic notation:
    • Numeric: chmod 4755 file sets SUID (4 = SUID).
    • Numeric: chmod 2750 dir sets SGID (2 = SGID).
    • Numeric: chmod 1777 /tmp sets the sticky bit (1 = sticky).

Demo: Shared directory with SGID + sticky bit

Scenario assumptions:
  • Two users: dev1 and dev2.
  • Both users are members of group devteam.
  • We create a shared directory /shared, make root the owner, and configure group-controlled collaboration.
  1. Create the shared directory, set ownership and SGID with full owner/group permissions, no permissions for others:
  1. Verify directory permissions and SGID bit:
Expected output (the s in the group permission slot indicates SGID):
  1. Test SGID inheritance:
  • Switch to dev1, create a file in /shared, and inspect ownership.
Expected output (note the file group is devteam due to SGID on the directory):
SGID ensures new files inherit the shared directory’s group, helping teams manage group access consistently.
  1. Enable the sticky bit so only file owners (or the directory owner/root) can delete files:
Expected output (notice the uppercase T because “others” have no execute bit; sticky bit is present):
  1. Test deletion restriction with the sticky bit:
  • Switch to dev2 and try to remove file1 (owned by dev1).
Example session showing the deletion is blocked:
Even though dev2 is in devteam and group permissions might otherwise allow deletion, the sticky bit prevents dev2 from removing a file owned by dev1. Only dev1, the directory owner (root), or root can remove it.
Do not broadly apply SUID to arbitrary executables—doing so can introduce serious security risks. Use SUID only for carefully audited programs that require it.

Real-world SUID example: /usr/bin/passwd

A classic SUID binary is /usr/bin/passwd. Regular users must be able to update their password, which requires writing to /etc/shadow—a file owned by root. Setting SUID on the passwd program allows the program to run with root privileges while the user still only executes the passwd binary. Check the passwd binary:
Example output showing the SUID bit in the owner permission (s in place of x):
Because passwd is setuid to root, it can update /etc/shadow on behalf of a user without granting the user full root privileges.

Summary and best practices

  • Use SGID on shared directories to ensure new files inherit the group’s ownership and simplify permission management.
  • Use the sticky bit on shared directories (like /tmp or team shares) to prevent users from deleting other users’ files.
  • Apply SUID sparingly and only to well-audited, trusted binaries that require elevated privileges for a limited, specific task.
  • Always verify permission bits with ls -l and test behavior with representative users.
Further reading and references:

Watch Video