I am trying to give 2 users rwx access to a new shared directory i have created that will hold some shared documents. The directory is /srv/shared The 2 users are Mason and Bill that will be accessing the files. I would like both users to be able to rwx any newly created files/directories by each other.

I have added Bill to the group Mason with sudo usermod -a -G mason bill I then changed the /srv/shared ownership to Mason and group Mason with sudo chown mason:mason /srv/shared

I then tried creating a directory in /srv/shared logged in as bill with mkdir /srv/shared/test but got access denied. I tried giving the directory chmod 755 permissions but that still gave Bill access denied when creating files. When i gave chmod permissions 777 Bill could then create directories and files without an issue.

Just trying to work out what I have done wrong for this to only work with 777 permissions which is not really what i want to allow?

  • How are you sharing? Multi user Linux system? CIFS/Samba server? NFS? SSHFS mounts?
    – ivanivan
    Aug 27, 2017 at 13:35

2 Answers 2


Add the users mason and bill to a new group, lets call them mbshare. Then change the permissions and group on the share point to match the new group. Finally add the users to the group.

// create a new group
sudo groupadd mbshare
// change the permissions on the sharepoint
sudo chgrp -R mbshare /path/to/share
sudo chmod -R 2775 /path/to/share
// make the users part of the share group
sudo usermod -aG mbshare mason
sudo usermod -aG mbshare bill

Now mason and bill can create and edit files in /path/to/share.

The 2 in the 2775 permission flag means: (setGID bit) new files will have the same group as the directory and subdirectories inherit the same as parent.

If you only want mason and bill to see the files within the share, use 2770 instead of 2775.

The advantages of creating a custom group are significant.

  • It is easy to add or remove a new user to the group.
  • You can quickly see who has access to the group.
  • You can remove any user without the need to change any permissions.
  • Keeps things very neat and tidy :]

Edit: Corrected a few "from memory" errors.

  • Thanks very much for this, will give it a try. Would i need to create a user though named mbshare to be able to chown mbshare:mbshare /path/to/share
    – Mason
    Aug 27, 2017 at 10:42
  • The mbshare group name was just an example name. You can call the group (almost) anything you like within the rules of a group name. For example: internalshare, groupshare, projectname, sharedjunk. What ever you call the group, substitute that in place of mbshare in the chown.
    – Tigger
    Aug 27, 2017 at 10:48
  • I see what you mean regarding the share name, i thought chown 'mbshare:mbshare' means change ownership of this directory to user mbshare and group mbshare. Obviously user mbshare does not exist only the group mbshare does.
    – Mason
    Aug 27, 2017 at 10:55
  • @Mason Fixed a number of errors.
    – Tigger
    Aug 28, 2017 at 8:56

It should be 775. Since both of them belong to same group. The group should have rwx right. The first 7 for the owner and second 7 for the group.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .