In this article, you will learn about what is SGID permission in Linux and How to use it?
SGID stands for Set
Group IDentification. We use SGID to give special permission in the
group section of the permission. You can also read first about What is SUID bit or special permission in Linux?
We have a system admin group, or we have certain sales user groups or any other department, and we want to give any special permission for a file. In this case, we can use the SGID permission.
To understand this concept, I’m going to create a file with the name amit. Below you can see that file with permission.
We can break the above permission for understanding like below,
- (this indicate the file)
rw- (this for
r-x (this is for the
r– (this for
There is two difference i.e. small
s and capital
rwx +s =
rws (Small s means, the user has both
rw- +s = rwS (Capital S means, the user has only special permission)
As we know that this SGID permission works on the
group, here the group name is
sahil and permission for the group is
Now I’m giving special permission to file
The symbolic mode
chmod g+s amit
g represents the
amit is the file name, you can change it with your file name, after pressing enter to apply for the permission, Capital S represents that it has only special permission. As a result, you can look like the below picture.
Absolute mode or Numerical or Octal method
You can also give permission to use the
In the octal method, SGID is represented by number two (2). So the command will be.
chmod 2664 amit
How to find all the SGID permission set file in Linux
find / -perm /2000
Here, I am looking for SGID set files in
/ (root partition or root directory). If you are looking to another place, then change the
/ with your specific location.
In this tutorial, you learned about SGID permission in Linux. It is special permission. We don’t generally need it, but you must know it. I hope you understand, but if you have any questions, you can ask in the comment section.
Also, you can further read,