Code in this video_Samba Server – Set Up Read/Write Access for Users and Read-Only for Guests on Linux

✳️ Replace the highlighted information with your own


sudo useradd -M -s /usr/sbin/nologin samba-3

sudo groupadd grp-samba-3

sudo usermod -aG grp-samba-3 samba-3

[Share-3]
path = /Samba/Share-3
browseable = yes
guest ok = yes
guest only = no
read only = yes
write list = @grp-samba-3
force group = grp-samba-3
create mask = 0664
directory mask = 2775

Parameter explanation:

  • [Share-3] is the name of the shared folder — this is what users will see when they browse the network.
  • path line specifies the actual directory on the server, which in this case is /Samba/Share-3.
  • browseable = yes means this folder will appear when users browse available network shares.
  • guest ok = yes allows guest users to access the share without logging in. If guest only = no means both guest users and authenticated Samba users can access it.
  • read only = yes makes the share read-only by default, so users can view but not modify files.
  • write list = @grp-samba-3 grants write access to all members of the grp-samba-3 group.
  • force group = grp-samba-3 ensures that all files and folders created inside this share automatically belong to that group, keeping permissions consistent.
  • create mask = 0664 sets the default file permissions — the owner and group can read and write, while others can only read.
  • directory mask = 2775 defines default permissions for new folders and ensures they inherit the grp-samba-3 group automatically.

Read more

Leave a Reply

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