I have a shared folder set up on an ubuntu machine. When someone connects to the folder and creates a file, the file permissions set the group to read/write. I can check the permission on Ubuntu or Windows and they both show the group has read/write permission.

The problem comes when a user tries to edit a file created by another user. For example, user1 creates a text document. If user2 connects to the shared folder they can open the text document but when they try to save the file there is an error saying they don't have permission. Each user is also a part of the same group.

My samba.conf file addition looks like this:

[foldername]
    page = /home/path/to/directory
    writeable = yes
    browseable = yes
    read only = no
    valid users = user1, user2, user3, user4
  • Thanks Jacob. That's actually the process I went through to set up the shared folder. When a file is created inside the shared folder the permission show up as being correct but a user outside of the creator is not able to make edits to the created file. – user715564 Mar 10 '14 at 20:15
  • @user715564 How have you created the share (with Nautilus, Personal File sharing, ...)? – Salem Mar 10 '14 at 20:19
  • I created a folder on the desktop set it be a shared folder and set up samba to allow access to each user. I am using acl to assign created files/folders to be set under the group that each user is in. – user715564 Mar 10 '14 at 20:22

Another possible solution is to set the "setgid" bit on your shared directory. This means that all files/directories created in the shared dir will automatically belong to the group. Like this:

chmod g+s <directory name>

You may also have to do this on existing subdirectories. In the future, when new directories are created, the setgid bit will automatically be turned on for them.

I just tested it out according to this simple tutorial ("quick 'n dirty") and I think it cannot miss, it works perfectly for all users (I tried). The key is

   create mask = 0777
   directory mask = 0777

...which will take care of the permissions in the way you want it.

  • 2
    This gives rwx permissions to all authenticated users on the server. Not so great unless you can trust everyone with a login and putty/ssh. – outis nihil May 17 '15 at 18:22
  • @outisnihil true of course, but that seems obvious. – Jacob Vlijm May 17 '15 at 18:32

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.