The setuid and setgid special permission bits

We can see that setuid program binaries are an important takeaway from the preceding discussion; let's summarize it once more:

  • A binary executable file with the owner execute bit set to s is called a setuid binary.
  • If the owner of said executable file is root, then it's called a setuid-root binary.
  • When you execute a setuid program, the key point is that the EUID is set to the owner of the binary executable file:
    • Thus, with setuid-root binaries, the process will run as root!
  • Of course, once the process dies, you are back to your shell with your regular (default) set of process credentials or privileges.

Conceptually similar to setuid is the notion of the setgid special permission bit:

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.