7

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
user715564
  • 171
  • 1
  • 1
  • 3
  • see http://askubuntu.com/questions/52584/shared-folders-for-all-users – Jacob Vlijm Mar 10 '14 at 20:09
  • 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
  • doesn't work, still access denied, I have full 777 permissions locally and in the share settings. – Sephethus Dec 03 '20 at 20:33

2 Answers2

1

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.

Alex D
  • 111
  • doesn't work, did this on all dirs – Sephethus Dec 03 '20 at 20:33
  • @Sephethus Looks like there must be another problem with your Samba configuration. This answer is showing how to ensure that all files created in the shared directory will belong to the same group that owns the directory. – Alex D Dec 05 '20 at 14:30
0

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.

Jacob Vlijm
  • 83,767