Linux / Unix

Grant write permissions to multiple users on a folder in Ubuntu

Create a new group like “DevOps” and add the desire users to the group.

sudo groupadd devops

Now since group is created, let’s add users to the group.

sudo usermod -a -G devops peter
sudo usermod -a -G devops jens

Now all that’s left is to set the permissions on the directory:

sudo chgrp -R devops /path/to/the/directory
sudo chmod -R 770 /path/to/the/directory

Now only these two members of the devops group can read, write, or execute anything within the directory. Note the -R argument to the chmod and chgrp commands: this tells them to recurse into every sub directory of the target directory and modify every file and directory it finds.

Author: Danyal
I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.