Theodoros Emmanouilidis

Notes & Thoughts

Give Read – Write Permissions To A Specific Group Of Users

January30

Suppose we have the need to give read – write permissions to a specific group of users. As an example we need a share folder to be readable and writable by all students in a specific class. The following guide addresses such an issue.

First we have to create the group.

1
sudo groupadd class01

Now we add some users and make them members of the class01 group,

1
2
3
4
5
6
sudo adduser student01:class01
sudo usermod -g class01 student01
sudo adduser student02:class01
sudo usermod -g class01 student02
sudo adduser student03:class01
sudo usermod -g class01 student03

we create the directory that will be shared to the group members,

1
sudo mkdir /media/shared/class01

and give the appropriate permissions.

1
sudo chmod -R g+rwxs /media/shared/class01

The above command will give full group read – write access to directory “class01” and also, will set the set-groupID flag so that directories created inside it inherit the group.

That’ s all!

posted under Tip Of The Day