I just changed my file permissions using $ sudo chmod g+s filename
and my file permissions turned from drwxr-xr-x
to drwxr-sr-x
. How do I remove it?
setgid() sets the effective group ID of the calling process. If the calling process is privileged (more precisely: has the CAP_SETGID capability in its user namespace), the real GID and saved set-group-ID are also set. Under Linux, setgid() is implemented like the POSIX version with the _POSIX_SAVED_IDS feature.
In Linux sticky bit can be set with chmod command. You can use +t tag to add and -t tag to delete sticky bit.
To remove the setuid and setgid bits numerically, you must prefix the bit-pattern with a 0 (e.g.: 0775 becomes 00775 ).
Change the +
for adding a permission into a -
to remove it:
sudo chmod g-s filename
To remove setgid the numerical way the command is
sudo chmod 0664 $filename
The assumption here is the permission on file is 664 and we are not changing it. The left most bit in the above command represents setuid(4),setgid(2) and sticky(1). Now to represent these symbolically setuid is u+s, setgid is g+s and sticky is o+t
Example 1:-chmod u+s filename This will setuid for the filename mentioned that is rwsr_xr_x
Example 2: chmod 2770 directory This will set gid for the directory mentioned that is rwxr_sr_x
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With