Samba share writable to everyone, even if someone else created the files? - eviltoast

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.

  • Nibodhika@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    I’m not 100% sure on this, but there’s a config in the general which tells samba which user to use, if none is defined it uses nobody. I assume that if you change that to the same user you use via SSH it should work.

    That being said, what you’re seeing is expected, it’s complaining that you copied files as user A to a public directory and now user B can’t delete them unless user A sets the files as read/write for everyone (chmod) or transfers ownership (chown). There’s a thing called ACL’s that should allow you to set the permissions to the same as the parent folder so you can have everything be 777, but I’ve never used it so can’t really help, however with the name you should be able to find some examples on the internet.

    • AggressivelyPassive@feddit.deOP
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago
        force user = sambapub
        force group = users
      

      This should set the user, and it’s exactly what I’m seeing if I copy files over via smb. I’m aware, that it’s kind if expected, but not what is intended (by me).

      • Nibodhika@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Are you using the sambapub user to SSH the files into the folder? I thought that the force user refered to a samba user, not a Linux user.