references: https://en.wikipedia.org/wiki/Setuid
Effects of setuid and setgid
-
On Executables “When the
setuidorsetgidattributes are set on an executable file, then any users able to execute the file will automatically execute the file with the privileges of the file’s owner (commonly root) and/or the file’s group, depending upon the flags set.” -
On Directories “Setting the
setgidpermission on a directory causes files and sub-directories created within to inherit its group ownership, rather than the primary group of the file-creating process. Created sub-directories also inherit thesetgidbit. The policy is only applied during creation and, thus, only prospectively. Directories and files existing when thesetgidbit is applied are unaffected, as are directories and files moved into the directory on which the bit is set”