What is difference between SetUID, SetGID & Sticky Bits ?

What is difference between SetUID, SetGID & Sticky Bits ?

         This question is one of the most important one in Linux interviews. So here we go !


Set UID: When a Set UID bit is turned on for a program, your EUID (effective user ID) becomes the same as the program’s owner when you run the program. You also gain all the privileges of the program’s owner. In other words, if user freddie runs a Set UID program owned by user root, freddie has superuser privileges while that program is running. Set UID affects programs only; it’s really not important for data files and directories. If you find a Set UID program, read the WARNING!!!

Warning: Set UID programs are potentially dangerous.Users can gain extra privileges by using files that grant them superuser privileges.

Set GID: The Set GID bit works similarly to Set UID — anyone running the program gains all the privileges of the group. When the Set GID box is checked for a directory, the files in that directory belong to that group regardless of who puts the files in the directory.


Sticky bit: Checking the Sticky box affects directories only. If this box is checked, you can’t remove (or rename) a file in that directory unless you’re the file owner.

Comments

Post a Comment

Popular posts from this blog

Recover or restore initramfs file in RHEL or CentOS 7

Space reclamation / UNMAP on RHEL or CentOS 7

How to recover /boot partition on RHEL or CentOS 7?