I have a public SMB share mainly as a media dump. Everyone can read and write, without any auth - as intended. However, if I copy files via SSH (as a regular user, not the samba user), these files are of course owned by that user and thus not writable for the samba user - so I can’t touch these files via SMB.

My config looks like this

[public]
  path = /path/to/samba/public
  guest ok = yes
  writeable = yes
  browseable = yes
  create mask = 0664
  directory mask = 0775
  force user = sambapub
  force group = users

I can fix the permissions by simply chown/chmod all files, but that’s not really a solution.

  • lazynooblet@lazysoci.al
    link
    fedilink
    English
    arrow-up
    16
    ·
    edit-2
    2 years ago

    Add the sticky group bit to the directory so that new files are created with the group of the directory.

    chmod 2775 /path/to/samba/public```
    
    Now any new file will have group "users".
  • jdnewmil@lemmy.ca
    link
    fedilink
    arrow-up
    3
    ·
    2 years ago

    Samba is a pipe of sorts… those settings only apply to files created using that pipe.

    SSH is a different pipe, with different configuration. I think you need to modify the umask of the user connecting via ssh and/or add them to a samba group.

  • nyan@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    2 years ago

    Untested Evil Method, Not Really Recommended: format the backing file system in vfat, which has no notion of file ownership.