Code in this video_Samba Server – How to Set Up Samba on Linux with User Permissions

✳️ Replace the highlighted information with your own


sudo adduser --no-create-home --disabled-login samba-1

sudo adduser --no-create-home --disabled-login samba-2

[Share-1]
path = /Samba/Share-1
browseable = yes
read only = no
writable = yes
valid users = @grp-samba
create mask = 0664
directory mask = 0775
force user = samba-1
write list = samba-1
read list = samba-2

[Share-2]
path = /Samba/Share-2
browseable = yes
read only = no
writable = yes
valid users = @grp-samba
create mask = 0664
directory mask = 0775
force user = samba-2
write list = samba-2
read list = samba-1

Parameter explanation:

  • [Share-1]: This is the display name of the shared folder on the LAN. You can change it to any name you prefer.
    • path = /Samba/Share-1: This is the actual path to the shared directory on the server. Samba uses this path to locate the files.
    • browseable = yes: This allows the folder to appear when users browse the network. If set to “no,” it will be hidden but still accessible via direct path.
    • read only = no: This means the share is not read-only, allowing users to edit or modify files.
    • writable = yes: This enables write access — usually used together with “read only = no”.
    • valid users = @grp-samba: Only users who belong to the “grp-samba” group can access this folder. Others will be denied even if they know the network path.
    • create mask = 0664: Defines default file permissions: the owner and group can read/write, others can only read.
    • directory mask = 0775: Similar, but for directories — allowing the owner and group to read, write, and access folders.
    • force user = samba-1: Ensures all files created in this share are owned by the “samba-1” user, making permission management easier.
    • write list = samba-1: Only the “samba-1” user is allowed to write to this folder.
    • read list = samba-2: The “samba-2” user can only read the files, not modify or delete them.

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *