I'm trying to set up a file server in our office and am having issues with default file permissions being inherited from the parent directory. I want the directory permissions to be inherited by all directories and files created in a directory. When a user creates a file or directory within my folder, I want the user and group permissions to both be rwx...perhaps rwxrwx--- as I don't care about "other".

I've been trying setfacl, chmod g+s and others but it's just not clicking for me for some reason. setfacl seems to work and getfacl is reporting what looks to be properly:

# owner: nobody
# group: Employees

I want all group members to have rwx privileges on all files and directories made underneath our shared folder.

Here's one of my big confusions: a text file made from the terminal window on the linux server comes back with default permissions of rwxrw-r-- and a file made in the same directory by the same user account gets me a permission of rwxr--r-- when the file is created from a Windows client...neither of which is the desired outcome, but I would expect the permissions to be the same whether created locally or remotely.

Thoughts anyone? (am checking umask in samba config right now...)

update: the smb.conf file was specifying a restrictive mask, thus the difference between windows and linux. I still cannot figure out why it's not setting default permissions on files created/copied in the directory though.

asked 25 Jul '13, 15:54

Joshua%20Gramlich's gravatar image

Joshua Gramlich
accept rate: 50%

edited 25 Jul '13, 16:04

And it's chmod for the win. I thought I'd done this earlier but I must have gotten confused. I set gid for the Projects folder and now users are creating files with the proper ownership.

sudo chmod g+s /share/Projects


answered 26 Jul '13, 11:42

Joshua%20Gramlich's gravatar image

Joshua Gramlich
accept rate: 50%

You provide few details about your situation/configuration but I'm wondering if the umask of your server process(es) doesn't come into play at some point. EDIT: Ah, I see smb.conf mentioned so umask is unlikely to be a factor.

You can always inflict file modes/owners/groups retroactively with the combination of the --recursive and --reference options to ch{mod,own,grp} thus:

 cd rootOfHierarchyInQuestion ;
 for command in chown chgrp chmod; do
   sudo $command --recursive --reference=. . ;

...but I gather that's not what you want.


answered 26 Jul '13, 10:12

mod's gravatar image

accept rate: 0%

edited 26 Jul '13, 10:21

Yeah, I didn't word this very well at all. I should just start from the beginning.

I want all new files and folders created in my samba share to fall under group ownership of the group that owns the main folder.

I've changed the mask in samba to 775 but that didn't really seem to have an effect. I am still getting different permissions on files created within linux than I am with files created in windows.

I have a directory within my share called Projects (the share being /share). So on /share/Projects I have permissions of drwxrwxr--. Projects is owned by nobody.Employees. If I su over to my own user account within Linux and vi up a couple of test files, I get permissions of -rw-rw-r--. If I use the same user account and create the files in notepad from windows I'm getting default file permissions of -rwxrw-r-- and ownership of user.user.

I guess my real problem is the group ownership issue. I can deal with windows clients creating -rw-rw-r--. None of this stuff should need execute privilege. My real problem is the ownership. The users may maintain user ownership, that's not a problem, but I need the group ownership to be that of the parent directory...this is where I'm having my problems.



answered 26 Jul '13, 10:53

Joshua%20Gramlich's gravatar image

Joshua Gramlich
accept rate: 50%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 25 Jul '13, 15:54

Seen: 3,671 times

Last updated: 26 Jul '13, 11:42

powered by OSQA