Make a Directory for A Group
Let’s suppose that you want a directory called ‘develdir’ to be available for a group of 2 users called ‘username1’ and ‘username2’. Those two users will be able to put files in the directory as well as read and edit all the files. Here is how to do this as root or using ‘sudo su’:
mkdir develdir groupadd devel addgroup username1 username2 devel chgrp devel develdir chmod g+s develdir umask 002 develdir
- make the directory
- make the group
- add users to the group
- change the group on the directory to the new group. The owner is the same as it was, but the group is now ‘devel’.
- put the suid bit on the group for the directory
- make all the files created in the directory have full privilege for owner and group so that the members of the group can work with them
If you need to keep permissions on a copied file, use ‘install -m 666’ or ‘cp -a’ to copy files.
That’s a nice post.