Interview Prep/Linux/Permissions, Users & sudo

What is SUID and give a real example?

IntermediateConceptPermissions, Users & sudo
Answer

SUID (4000) on an executable makes it run with the file owner's effective UID, not the caller's. passwd is SUID root so a normal user can update /etc/shadow.

ls -l /usr/bin/passwd      # -rwsr-xr-x
chmod u+s binary; chmod 4755 binary
find / -xdev -perm -4000 -type f 2>/dev/null   # audit SUID files

Linux ignores SUID on scripts; it only works on binaries. Unexpected SUID binaries are a privilege-escalation red flag.

All Linux questions Roadmap: Linux

More on Permissions, Users & sudo