:PROPERTIES:
:ID: 9d3e38ca-baf4-4e49-b9b0-416036ac85e3
:mtime: 20240525072544
:ctime: 20240525072542
:END:
#+title: setuid
#+filetags: :public:project:
* Setuid
The setuid bit is contained inside a unix [[id:ed51220f-42e4-4491-8307-714a26a01224][inode]].
- Normally processes inherit permissions of invoking user
- setuid/setgid allow user to “become” someone else when running a given program
When the setuid bit is on, and a user executes that file, the user ID is set to that of the owner of the file; when the bit is off, however, the user ID does not change.
** Example of Setuid
For example, when a user A (that is, a user with userID = A) starts executing a file owned by B, whose associated domain bit is off, the userID of the process is set to A. When the setuid bit is on, the userID is set to that of the owner of the file: B. When the process exits, this temporary userID change ends.