1

I have a software RAID array set up on PC with Ubuntu 16.04 Gnome, with the resulting /dev/md0 formatted as EXT4 and mounted as /RAID. I'm using Samba to share various directories from this machine's /RAID (Example /RAID/Documents). New files are getting created with mode bits 744 (from a windows machine) or 644 (from a linux machine). This leads to a user creating a file, then another user cannot edit the file.

In creating users for Samba sharing, I added them with no home directory, so there are no user-related ~/.profile, ~/.bashrc, etc. to modify (except for my login). I've tried to affect a new umask by changing "session optional pam_umask.so" to "session optional pam_umask.so 0000" in /etc/pam.d/common-session. I've also tried changing the umask in /etc/login.defs. These all seem to be associated with new users, however, and they certainly don't seem to be changing anything for me.

How do I affect default mode bits for new files and directories, so directories will be 777 and files will be 666? It sounds like one approach may be to use an ACL, but I was hoping to not have to go through that learning curve!

Thanks, in advance! Scott

0

This leads to a user creating a file, then another user cannot edit the file.

This is one approach - not the only approach: If you want all users to be able to edit each others files then instead on changing modes on all new files change the identity of those users to a local user that has access to the shared folder ... like you. For example:

[Documents]
path = /RAID/Documents
read only = no
valid users = mork mindy
force user = strobelight

Only mork and mindy will be able to access the share but once samba lets them in their identities will be changed to strobelight. All new files will be saved with owner = strobleight. No need to change modes.

  • Makes me glad I stated my whole problem, and not just my question around file mode bits. Actually, I like this solution better than monkeying with the file mode bits, as it's more secure, and this issue only affects one of my shares. I've implemented this and it's working great. Thanks for the response, and oh, by the way, love the Mork and Mindy reference. That, and the fact I get it, shows both of our ages! – Strobelight Jul 31 '18 at 16: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.