Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a RAID10 array mounted on Ubuntu Server 12.04. I have created a few folders within the mount point and want the following functionality.

There will be 4 users, 3 of them are windows users: 'one' 'two' & 'three'. 'four' is a media streamer that only needs to access the MEDIA share. One Two and Three need to have full access to the media share and their own personal shares (for documents) which no other users but them can access.

Currently, User Four works perfectly (Has full access to the MEDIA folder and can't access folders owned by other users). The problem is, when logged in as the other user, I can't access either share; (tried using valid users = and using chmod to add permissions to no avail).

TL;DR: I need to know how to configure Samba properly to restrict access to certain shares for certain users and allow all of them to access one communal folder (all files on a RAID10 mount).

share|improve this question
up vote 21 down vote accepted

Each samba user must have a normal linux account as well.

  1. Make sure that every user can access the common media folder on the unix side (without samba); alternatively, you can set force user in smb.conf
  2. Make sure each user has a samba password set. You can set it with sudo smbpasswd -a your_user
  3. Look at /etc/samba/smb.conf: check if the line security = user is set in the [GLOBAL] section
  4. Set your shares in /etc/samba/smb.conf, see example

Example shares:

    path = /media/common
    read only = no
    writeable = yes
    browseable = yes
    valid users = one, two, three, four
    create mask = 0644
    directory mask = 0755
    ; if you set this, all files get written as this user
    force user = one

This will be accessible via \\yourserver\allaccess

A single user share:

    path = /home/two/onlytwo
    read only = no
    writeable = yes
    browseable = yes
    valid users = one
    create mask = 0640
    directory mask = 0750

Restart the samba server after the changes with:

sudo service smbd restart
share|improve this answer
You sir are a god, the masks and force user was what I needed all along but didn't understand. – Liam Oct 29 '12 at 19:22
I think "read only" and "writable" are so-called "inverted synonyms" for one another. No need to set them both. – Mike Diehn Apr 8 '14 at 14:53
Awesome! I had done every thing except step #2. I've never seen that mentioned anywhere else in setting up samba shares. Thanks!! – Patrick Steele Dec 29 '14 at 0:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.