whatis setuid
SUID and SGID
Also known as: setuid, setgid, SUID, SGID
Special permission bits that make a program run with its owner's (SUID) or group's (SGID) privileges instead of the caller's.
What Are SUID and SGID in Linux?
SUID is how an ordinary user can run passwd and update /etc/shadow: the binary is owned by root with the SUID bit set, so it runs as root. It shows as an s in the owner execute position (-rwsr-xr-x).
SGID on a directory makes new files inherit the directory's group, which is useful for shared team folders. SUID binaries are a classic privilege escalation target, so audit them with find / -perm -4000.
Example
ls -l /usr/bin/passwd
# -rwsr-xr-x 1 root root ... /usr/bin/passwd
chmod g+s /srv/shared Learn more about SUID and SGID
- SUID Explained The SUID bit lets a program run with the permissions of its file owner instead of the user who launched it. This guide explains how SUID works, why it exists, and why it is a common security concern.
- SGID Explained The SGID bit behaves differently on files versus directories, most commonly used to keep every new file in a shared team folder consistently owned by the same group. This guide explains both behaviors clearly.
Related tools
- chmod / chown Builder Work out permission octals and ownership commands with a visual rwx matrix.