Samba: Basic smb.conf example

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
^rooker
Site Admin
Posts: 1481
Joined: Fri Aug 29, 2003 8:39 pm

Samba: Basic smb.conf example

Post by ^rooker »

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
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!
Post Reply