SUID, SGID, Sticky Bits, which one to use?

drwxrwxrwt - Sticky Bits - chmod 1777
drwxrwsrwx - SGID set - chmod 2777
drwsrwxrwx - SUID set - chmod 4777

The SUID permission makes a script to run as the user who is the owner of the script, rather than the user who started it.

If a file is SGID, it will run with the privileges of the files group owner, instead of the privileges of the person running the program.

If a directory is SGID, it will inherits the privileges of the directory group owner.

Sticky Bits:
If the sticky bit is set for a directory, only the owner of that directory or the owner of a file can delete or rename a file within that directory.

Mostly use in /tmp folder

No comments: