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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.