Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to prevent executable flag setting for new files? #209

Closed
dzubape opened this issue Jun 21, 2019 · 7 comments
Closed

How to prevent executable flag setting for new files? #209

dzubape opened this issue Jun 21, 2019 · 7 comments
Assignees

Comments

@dzubape
Copy link

dzubape commented Jun 21, 2019

Hello! I try all options from official samba docs, but none works.

  1. Your smb.conf file has:
create mask = 0664
force create mode = 0664

and it seems ok for my case

  1. I tried to add:
map archive = no
map system = no

but it not works

  1. I tried readonly = yes + writelist

  2. I tried readonly = no

In all cases every new file, created with samba (both from Linux and Windows clients), creates file executable. I need all files 0644 only. How to fix it?

@darkdragon-001
Copy link

Did you check the permissions on the original files within the container?

I guess it is a mounting problem. For me, the mounted files all have executable bit sit, while the files in the volume don't.

@dperson dperson self-assigned this Jul 7, 2019
@dperson
Copy link
Owner

dperson commented Jul 7, 2019

I'm not seeing the execute bit being set on files created on the share...

@dperson dperson closed this as completed Jul 7, 2019
@asgillmor
Copy link

I have experienced this too. Fresh install of Ubuntu 18.04 and docker. MacOS as a client.

total 40
drwxrwxr-x+ 2 alex alex 4096 Jan 28 16:05 test_dir_2_from_macos
drwxrwxr-x+ 2 alex alex 4096 Jan 28 16:01 test_dir_from_macos
drwxrwxr-x  2 alex alex 4096 Jan 28 15:58 test_dir_on_server
-rwxrwxr-x+ 1 alex alex   33 Jan 28 16:06 test_file_2_from_macos
-rwxrwxr-x+ 1 alex alex   12 Jan 28 16:01 test_file_from_macos
-rw-rw-r--  1 alex alex   14 Jan 28 15:58 test_file_on_server

I believe these are more or less tied to default configs that you generate in smb.conf. The + is suggestive of some ACL stuff. When I added the following acl_xattr:ignore system acls = yes to the end of smb.conf it fixed the file structure at least.

-rw-rw-rw-  1 alex alex   12 Jan 28 16:20  test_file_3_from_macos
drwxrwxrwx  2 alex alex 4096 Jan 28 16:20 'untitled folder'

So at least it now respects the create mask on the file, but not the directories.

Maybe this is as intended but there's a lot of configs that are hidden in samba.sh and Dockerfile that might be better served in a configuration file.

@asgillmor
Copy link

Setting the following param -g 'vfs objects = catia fruit streams_xattr instead of the coded vfs objects = acl_xattr catia fruit recycle streams_xattr (e.g. removing acl_xattr) will make it so that your file/directory create masks will be respected.

total 20
drwxrwxr-x  2 alex alex 4096 Jan 28 16:54  test_dir_from_server
-rw-rw-r--  1 alex alex   21 Jan 28 16:56 'test file from client'
-rw-rw-r--  1 alex alex    0 Jan 28 16:54  test_file_from_server
drwxr-xr-x+ 2 alex alex 4096 Jan 28 16:55  test_folder_from_client

But I can't see to rename folders on the fly from the client

@nelsyeung
Copy link

@asgillmor Thank you so much! I was pulling my hair out for this problem. Just one comment is that you've also removed recycle in your example, which is not necessary.
I now have this in my docker-compose.yml environment:

environment:
  GLOBAL: vfs objects = catia fruit recycle streams_xattr
  # ...

dperson pushed a commit that referenced this issue Jul 3, 2020
@jeff-h
Copy link

jeff-h commented Sep 3, 2020

Just for the record, in case anyone else hits this issue, having the acl_xattr specified also had the side-effect of breaking macOS's automatic versioning and saving. It caused Pages, Numbers etc to throw errors such as "the document could not be autosaved" and "the document XYZ could not be saved."

Removing it as per #209 (comment) fixed this issue for me.

@jeff-h
Copy link

jeff-h commented Sep 10, 2020

Hmm, scratch my last comment. I have since found that my issue was caused by connecting to the share via the Finder window "Locations" section (which results in a connection smb:https://servername._smb._tcp.local/Sharename). When I connect via cmd-k and enter smb:https://servername.local/Sharename macOS's automatic versioning and saving works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants