setuid (SUID) and setgid (SGID) are Unix / Linux terms, which are short for "Set User ID" and "Set Group ID", respectively. setuid (also sometimes referred to as "suid") and setgid are access right flags that can be assigned to files and directories is a Unix system. They are mostly used to allow users on a computer system to execute binary executables with temporarily elevated privileges in order to perform a specific task.
setuid and setgid are needed for tasks that require higher privileges than those which a common user has, such as changing his or her login password. Some of the tasks that require elevated privilege may not immediately be obvious, though — such as the ping command, which must send and listen for control packets on a network interface.
setuid and setgid flags on a directory have an entirely different meaning.
Directories with the setgid permission will force all files and sub-directories created in them to be owned by the directory group and not the group of the user creating the file. The setgid flag is inherited by newly created subdirectories.
Linux > More on USER ID, Password, and Group management
How Linux file permissions work