Server Fault is a question and answer site for system and network administrators. 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've mounted a shared windows directory (C:\foo\bar) on an ubuntu server (/mnt/shared/bar) like so:

//windows-server/bar /mnt/shared/bar smbfs credentials=/etc/samba-credentials 0 0

It works great, but when I cd into /mnt/shared/bar, Ubuntu shows that all the files are owned by root.

I'd like to restrict access to /mnt/shared/bar on the linux side. For example, I'd like to only allow users in the "baz" group to have access to the /mnt/shared/bar directory.

I'm new to Samba. Can someone with more experience let me know if this is possible?

share|improve this question

If you were using CIFS instead of SMBFs, using ACL's and Samba's PAM module you would be able to use the proper ACL's from the physical file server. It may seem like a big change to your linux host, but it's worth it, that is assuming you're using active directory.

share|improve this answer
Our windows servers are using active directory. Our linux servers are using OpenLDAP and the goal is to eventually move everything to use OpenLDAP groups to secure windows shares. So, I guess maybe the next step is to configure the Windows Box to use OpenLdap. If windows was using OpenLdap, then I'm assuming I could use your advice and use same OpenLdap groups everywhere? – Dave Paroulek Sep 13 '11 at 20:18
Dealing with LDAP is a whole different beast that I don't feel qualified to remark on--but my understanding is that you should be able to adapt samba and pam to digest your ldap data however you want it organized. But the real key here is doing your system authentication with samba if you want your heterogeneous environment to work well. You need to get your linux machines on the windows domain (or vise-versa, if you plan to have samba run your domain) – andyortlieb Sep 13 '11 at 20:55

Specifying the gid will map the share ownership to that group.

To find the gid: getent group baz | cut -d: -f3

New command: //windows-server/bar /mnt/shared/bar cifs credentials=/etc/samba-credentials,gid=<baz gid> 0 0

share|improve this answer

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.