0

I used to run Windows Server and file sharing off my NAS was a breeze. I’ve worked out most permissions to make it work how I need and primarily use Samba to serve out the files.

The only task I’m having trouble with is creating a Shared Files folder to map on each client. It seems Linux always creates files and folders under the users with 755 permissions, so when contents are created in this folder other users can’t modify or delete them.

In Windows/NTFS I was able to set the Shared Files folder to R+W for Everyone and make everything under it inherit this, which meant the folder was as intended free for all. I’m yet to find how to get Linux to do this.

Ubuntu Server 16.04.3 LTS

2 Answers 2

1

Set the permissions on the root of the share (i.e. the SAMBA path directive) to 077x (where x can usefully be one of 0, 5, or 7) and let SAMBA worry about permissions. You only need to mix UNIX/Linux filesystem permissions and SAMBA permissions if you have different ways of accessing files in the filesystem corresponding to the SAMBA share.

If you want all your users to be equivalent, use the force user directive. This will ensure that all users accessing the share are treated as the same user in the UNIX/Linux filesystem. (It is nothing to do with authentication - users can still authenticate using individual accounts if that's what you have set up.)

Here's an example of a share that does exactly this. The "remote" user and group is the local UNIX/Linux account that will own the files. The "family" group is the set of accounts that my family and I use to authenticate to the share.

[Family]
        comment = Shared
        valid users = @family
        path = /home/remote/shared
        vfs objects = recycle catia
        browseable = Yes
        read only = No
        force user = remote
        force group = remote
        force create mask = 0664
        force directory mask = 0775
0

You can use create mask and directory mask configuration option to configure more permissive umask to allow group members (or everyone) to modify files.

For example:

create mask = 0775
directory mask = 0775 

There are also respective force crate mode and force directory mode options. When used the respective permissions are always added to created files and directories.

Depending on how your users are configured:

  • If all your users share a common primary group, using above options is sufficient.

  • In case the primary groups aren't shared, but users are members of common group, set the directory group to the common group and apply setgid bit to it. When setgid bit is set to a directory, new files created inherit the directory's group and new directories created will have the setgid bit set as well.

  • Use POSIX Access Control Lists. To enable ACL for a file system, you might need to use acl mount option. When default ACL is set for a directory, new files and directories created inherit the default ACL. See the answer for how to inherit group permissions in Linux for details.

You must log in to answer this question.

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