2

I am trying to setup a little home network using Linux as the File Server and have run into a bit of problems w.r.t. to folder permissions that I can't seem to solve. The setup:

  1. An Ubuntu 14.04 Linux File Server with Samba configured.
  2. A couple of Windows 7 client machines.

Every person in the house has been given a username/password to the Linux File Server and they can login to the server using SSH/Putty/whatever fine.

Samba on the Linux File Server has been configured to share out a couple directories in writable mode to Windows, and all the client machines can see this and read and write files. As an example, lets say that /media/data/photos is shared out as \fs01\photos. All Windows users can write to this photos directory and it works great. They can make sub-directories, put pictures, whatever, everything works.

The issue is that I want these shares (and all the directories beneath them) to be a free for all. Any user should be able to edit/rename/move/copy/delete any file from these folders. The problem arises when one user tries to move/organize/remove/rename files created by other users. So lets say that user A creates /media/data/photos/2014NewYearsEve and user B decides that it really should have been /media/data/photos/2014/NewYearsEve instead. In the way that I've set it up right now, I keep getting permission errors.

I understand that by default in Linux, the user that created the file is the owner of the file, so I get where the errors are coming from, and I know how to correct it manually (chown and chmod, and then any user can manipulate the files fine). But since the shares (e.g. /media/data/photos) are "common", I want the permissions to automatically reflect this when the file and directories are created. Coming from a Windows background (this is my first real Linux setup), I am quite confused on how to fix this.

Here is what I have tried (based on a whole bunch of articles on the internet, stackexchange and stuff):

I changed the group of the directory /media/data/photos to "nogroup" (sudo chown nobody:nogroup /media/data/photos) I set the setgid flag on the /media/data/photos directory (sudo chmod g+s /media/data/photos).

After this, files that are put in the shares seem to get the right group assignment (ls -l shows nogroup for the new files and subdirectories). But the execute right necessary (I think its necessary right?) to move files seem to be missing from the group (the permission in ls -l is -rwxrw-rw- for files and drwxr-sr-x+ for directories).

How do I get Linux to automatically add the x bit for the group for both files and directories? Or maybe more generally, how do I make the shares free-for-alls?

1

Create a new Group called Family. Give Family RWX Permissions, i.e. 777, for all folders attached to the samba share, and make family the owning group of the folders. Then add each family member to the group family.

  1. groupadd family
  2. chown -Rv root:family /linux/path/to/samba/share
  3. useradd -G family *username for mom*
  4. useradd -G family *username for dad*
  5. Repeat steps 3 and 4 until all family members are in family.
  6. chmod -Rv 0777 /linux/path/to/samba/share

New items will inherit the permissions from the owner, but if the owner is a member in family, it won't matter

  • This is what I did: chgrp family /media/data/photos, setfacl -m g:family:rwx /media/data/photos, but new files don't inherit this permission (getfacl shows no family record in the acl)... Unless you meant something completely different (sorry, a little new to Linux) – syazdani Jan 1 '15 at 19:02
  • See Edit for updated directions – eyoung100 Jan 1 '15 at 19:05
  • 1
    I also had to set the directory mask value in smb.conf to make it assign out 774 to new directories, but this definitely works. Thanks. – syazdani Jan 1 '15 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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