What is SGID?
SGID (Set Group ID
up on execution) is a special type of file permissions given to a
file/folder. Normally in Linux/Unix when a program runs, it inherits
access permissions from the logged in user. SGID is defined as giving
temporary permissions to a user to run a program/file with the
permissions of the file group permissions to become member of that group
to execute the file. --> In simple words users will get file Group’s permissions when executing a Folder/file/program/command.
How can I setup SGID for a file?
SGID can be set in two ways
1) Symbolic way (s) 2) Numerical/octal way (2, SGID bit as value 2)
Symbolic way:
chmod g+s file1.txtLet me explain above command we are setting SGID(+s) to group who owns this file.
Numerical way:
chmod 2750 file1.txt* ls -l (before set SGID)-rw-r--r-- 1 root root 0 May 1 13:28 file1.txt* ls -l (after set SGID)-r-xr-Sr-- 1 root root 0 May 1 13:28 file1.txtHow can I remove SGID bit on a file/folder?
chmod g-s file1.txt
No comments:
Post a Comment