[SOLVED] How to automount a Samba network share read-write for multiple users on boot?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to automount a Samba network share read-write for multiple users on boot?
Hi everyone,
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:
[1] On the server, I created a group called "machines", and added a new user "client-machine" to it.
[2] 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").
[3] 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!
This question/problem must have come up several times without doubt
probably has, but I haven't stumbled across any post about it - but across the problem itself.
Quote:
Originally Posted by ask
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.
Yes, that rings a bell. I had the same effect about a year ago. Strange enough, from a Windows client I had full access!
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
Code:
unix extensions = no
to the global section of my smb.conf file - and hey, that worked. No ACL stuff, however.
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 ...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.