Setgid

Similar to setuid, the setgid functionality gives the user the ability to run scripts with a group owner's privileges, even if it is executed by any other user:

    $ chmod g+s filename

Alternatively, you can use the following command:

    $ chmod 2777 filename

File permissions after any of the preceding two commands will be drwxrwsrwtx.

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.