Enable multiple users Read and Write permission for files within a folder

Lets assume we have two web developers working on the same web project and they will need a single shared location to store and collaborate their development work with each other. In bellow example I have taken “/var/web-dev” as the shared location and it’s owned by Apache user (www-data). Two developers, danny and penny, needs to store their development work in “/var/web-dev”.

Assuming we already has logins for danny and penny, we have to add them to Apache user group.

usermod -aG www-data danny
usermod -aG www-data penny

Then set the execution bit and write permission for group for /var/web-dev.

chmod -R g+w /var/web-dev/
chmod -R g+s /var/web-dev/

Make sure they have their umask set as at least 002 (system default is 022). This will make any new files created read/write to group. To apply umask setting automatically at login, you would add the umask command to your .login file (C Shell users) or .profile (Bourne and Korn Shell users).

One thought on “Enable multiple users Read and Write permission for files within a folder

Leave a Reply

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