Sunday, January 11, 2015

Setting GID in Linux

For Setting up of GID on the directory in Linux use following command:-

find . -type d -exec chmod 2775 {} \;

. :- directory under which you want to set the GID
-type d :- specifies the type i.e. to find only directory
-type f :- specifies the type i.e. to find only files

-exec :- executes, takes the output of the find command and gives as an input to other command
chmod :- for changing the permission
2775 :- 2 is the GID to be set for the directories, and 775 is the default permission for the directory
{} \; specifies the end of the function

Also if you want to ensure if all the files in the directory are having 664 permission use the following command

find . -type f -exec chmod 664 {} \;


Post a Comment