Results 1 to 5 of 5

Thread: Samba shared folder help

  1. #1
    Join Date
    Oct 2021
    Beans
    18

    Question Samba shared folder help

    What combination of parameters do I need to make a service/folder where authorized users (no guests) can enter and be able to add files and folders. Where everyone can read each others files and folders but no one can delete or modify anything except the user/owner that put it in there?

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Samba shared folder help

    The way to have different permissions in Samba is to have different shares for the different types of access rights.
    Samba ignores Unix permissions, but will set them as requested. So ...
    a) owners which are the only userid with write to the files, would have 1 share with full rights
    and
    b) non-owners which have to be in either an approved list or a normal Linux group, would have another, read-only, share.

    https://www.samba.org/samba/docs/usi...-CHP-8-TABLE-2 has a list of different permissions that can be applied to a share.

    This is a common pattern, BTW. I've never seen a more elegant way, but perhaps someone will post a different solution. I'm not a fan of any force user or force group options in business settings. There should be a userid tied to each file that relates back to an individual. In a home environment - go crazy - do whatever works for you, but there are risks.

  3. #3
    Join Date
    Dec 2009
    Beans
    6,576

    Re: Samba shared folder help

    See how far this example gets you:

    Code:
    sudo mkdir /srv/Shared
    sudo chown root:plugdev /srv/Shared
    sudo chmod 3775 /srv/Shared
    Code:
    [Shared]
        create mask = 0644
        force directory mode = 03775
        force group = plugdev
        path = /srv/Shared
        read only = No
        valid users = tester smbuser
    *** tester and smbuser can access the share.
    *** tester and smbuser can write to the share.
    *** tester and smbuser can read each others files
    *** neither user can delete or edit a file or subdirectory created by the other.

    EDIT: There's no real reason why I chose to use pludev as the group.
    Last edited by Morbius1; October 22nd, 2021 at 02:14 PM. Reason: corrected create mask mode

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Samba shared folder help

    but no one can delete or modify anything except the user/owner that put it in there?
    How does this get accomplished?

  5. #5
    Join Date
    Oct 2021
    Beans
    18

    Re: Samba shared folder help

    Quote Originally Posted by Morbius1 View Post
    See how far this example gets you:

    Code:
    sudo mkdir /srv/Shared
    sudo chown root:plugdev /srv/Shared
    sudo chmod 3775 /srv/Shared
    Code:
    [Shared]
        create mask = 0644
        force directory mode = 03775
        force group = plugdev
        path = /srv/Shared
        read only = No
        valid users = tester smbuser
    *** tester and smbuser can access the share.
    *** tester and smbuser can write to the share.
    *** tester and smbuser can read each others files
    *** neither user can delete or edit a file or subdirectory created by the other.

    EDIT: There's no real reason why I chose to use pludev as the group.

    What are 4 digit chmod commands? Where can I find info on this?

    Also it works! thanks!
    Now if only I can figure out how and why it works...
    Last edited by fjl05; October 23rd, 2021 at 02:53 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •