How to automount a Samba network share read-write for multiple users on boot?
This question/problem must have come up several times without doubt, but nevertheless I'm still struggling with it (and it's beginning to spin!).
I have a Samba network share (just a regular, all-default share) which I would like to automount at boot, so all users can have read-write access to it.
My steps so far:
 On the server, I created a group called "machines", and added a new user "client-machine" to it.
 On the client, I created a group called "remote", and added a new system user "client-machine". In addition, I added the "remote" group as secondary group to an existing user ("user1").
 I added the following line to /etc/fstab:
# network shares on samba server
//192.168.x.y/Music /media/Music cifs defaults,acl,credentials=/root/.smbcredentials,iocharset=utf8,gid=remote,uid=client-machine,file_mask=0777,dir_mask=0777 0 0
Where /root/.smbcredentials contains the Samba user name ("client-machine") and password.
Believe it or not, but on reboot (or issuing "sudo mount -a") this actually works :-) On opening Nautilus (Ubuntu's file manager), the network share shows up. However, documents (both new or copied) end up with permissions -rw-r--r--, so there's no way I can edit any document after it has been created or copied.
I then started searching the web... :-( The suggestions I found implied using (a) ACL, (b) umask, (c) scripts to mount the shares on login instead of on boot. I've tried (a) and (b) until I found this helpful post on ACLs, umask and shared directories. As considered (c), I found myriad suggestions, of which I couldn't decide which one was best.
Has anyone encountered the same issue? How did you cope with it? Any suggestions are more than welcome!
I also spent a lot of time searching, and came up with nothing. Then I happened to get a book on Samba (O'Reilly press, the title is just "Samba") and got aware of the directive "unix extensions". Just for a try, I added
My suspicion is that the two Linux machines detect behind Samba's back that they're of the same species, and negotiate access rights differently, bypassing the Samba configuration. Maybe that works for you too.
How's the weather in beautiful Amsterdam? - I visited the city a few times during motor yacht cruises through the Netherlands (moored in Oosterdok for the nights, close to the drawbridge of Prins-Hendrikskade), and I like it very much. Many of the small towns around as well, like Alsmeer and the Westeinder Plassen, Bodegraven or Gouda. Get back there every two or three years ...
[X] Doc CPU
[solved] How to automount a Samba network share read-write for multiple users on boot?
It works! I'm so happy! :p
Now all my directories & files are created with the dir_mask and file_mask specified.
btw. weather is ok. No snow this year, just an afwul lot of rain. Last December has been one of the hottest in hundred years..
|All times are GMT -5. The time now is 09:55 PM.|