Setuid

Setuid (set user ID, sometimes suid ) is an advanced Unix file rights for files or directories on the Unix operating system. Executable programs for which this bit is set to run with the privileges of the user who owns the file, rather than with the rights of the user running the file. On most systems, this only works for binary executables, but not for interpreted scripts.

This procedure allows non-privileged users and processes controlled access to privileged resources.

In the case of FreeBSD setuid causes on directories that it created files belong to the owner of the directory and not the one user who creates it.

Setting the SUID bit

With classic Unix commands like chmod the bit can with a call like

Be set, where object is at least one file or directory.

Even modern graphical file managers options, the bit graphically activate a checkbox on / off.

Pros and Cons

Advantage of this approach is its simplicity. In the kernel, only little functionality must be available to implement a wide range of access controls by external programs. It is sufficient in many cases, functionality after "privileged" and "non- privileged" to separate, and to leave the access control to setuid programs. Programs can be pruned in the rights of the addition, if the program is associated with a restricted user.

Clear disadvantage is that these setuid programs that belong to a higher authorized users such as root pose a security risk, because of their privileges. An error in one of these programs can easily compromise the entire system. Therefore, they are also often the target of local attacks. Therefore, mechanisms are generally preferred that work without setuid.

Classic setuid programs

Unix programs for which the setuid bit must be set for proper function are, as the su and sudo, which will start with them, thus, available root privileges the process to be started under another user context. Also mount and its counterpart umount usually require root privileges. Under Linux, but also normal users allows mounting and unmounting of drives that are marked in the / etc / fstab file the user option.

In all these cases, the utilities must each the opportunity to be available to perform actions with root privileges. The decision as to whether this should be allowed or not, but you have the responsibility of a privileged instance. They are usually decided on the basis of configuration files that can not be edited by normal users.

724893
de