inherit group permission on Linux folder

Dear Readers, this tutorial shows you how to inherit group permission on Linux folder. It’s always required when multiple people work on the same folder.
Here we have user1, user2, user3 and all these works on the same folder called dev.

We will add all these users into the same group called devops

Create group

groupadd devops

Add all the users to devops group

usermod -a -G devops user1
usermod -a -G devops user2
usermod -a -G devops user3

Give rwx permission for User and Group

chmod -R 755 dev

chown user1.devops -R dev

set the ā€˜sā€™ permission for the group.

chmod g+s dev

Login as each user and set umask as 0002

sudo su – user1
cd dev
umask 0002

exit

sudo su – user2
cd dev
umask 0002

exit

sudo su – user3
cd dev
umask 0002

exit

Now all the users user1,2,3 can have read, write, execute permission for users and group.
Now Group ownership gets inherited to all the files generated.

© 2018, Techrunnr. All rights reserved.

Questions Answered
Articles Written
Overall Points
Categories: Linux

prabhin

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

Leave a Reply

Your email address will not be published. Required fields are marked *

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.