Samba: Basic smb.conf example

Step-by-Step descriptions of how to do things.

Samba: Basic smb.conf example

Postby ^rooker » Wed Oct 26, 2016 4:15 am

I've configured countless numbers of Samba servers over the years, yet I always have to look up the right configuration options required - even if I just want to create a simple "read-only" or "write for all" share.

Therefore, I've finally decided to copy/paste some existing (and working) examples I'm using every now and then.

1) Read-only share:
Code: Select all
[browse]
    comment = Public Storage
    path = /mnt/storage
    browseable = yes
    read only = yes
    guest ok = yes
    follow symlinks = yes
    wide links = yes

This share is visible to anyone browsing the computer's SMB/CIFS shares in a file explorer.
Yet, it's marked as "read only".

These 2 options are necessary to provide access to symlink targets outside of the shared folder:
Code: Select all
    follow symlinks = yes
    wide links = yes

Remove this if you don't require it, since it might add additional security issues/concerns.

2) Hidden to public, but writable for "members":
Code: Select all
[members]
    comment = Data Storage: Member access
    path = /mnt/storage
    browseable = no
    read only = no
    guest ok = no
    write list = @member
    force user = member
    force group = member

In this example, I've created a user+group called "member". Access rights of the shared files are set so that all members of group "member" can read/write in the shared folder.
This option declares who is allowed to write to this share:
Code: Select all
    write list = @member


The last 2 options are enforcing the ownership of newly created files/folders:
Code: Select all
    force user = member
    force group = member


Don't forget to restart your Samba service!
On Debian-based distributions that's something like:
Code: Select all
$ services smbd restart


Enjoy :D
  • 0

Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
User avatar
^rooker
Site Admin
 
Posts: 1446
Joined: Fri Aug 29, 2003 8:39 pm
Reputation: 0

Return to HowTo's

Who is online

Users browsing this forum: No registered users and 1 guest

Who is online over last 24 hours

Users browsed this forum in the last 24 hours: No registered users and 15 guests

cron
Reputation System ©'