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 a skilled programmer specializing in Vue.js/Nuxt.js for front-end development and PHP Laravel for back-end solutions. I have a strong focus on API design and development, complemented by experience in web server setup and maintenance. My versatile expertise ensures seamless creation and maintenance of web applications, covering everything from intuitive user interfaces to robust server-side functionality. Passionate about coding and driven by a lifelong learning mindset, I invite you to explore more at danyal.dk.