LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to automount a Samba network share read-write for multiple users on boot? (https://www.linuxquestions.org/questions/linux-general-1/how-to-automount-a-samba-network-share-read-write-for-multiple-users-on-boot-921196/)

ask 12-30-2011 03:58 AM

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!

Thanks already,
Memel

Doc CPU 12-30-2011 04:32 AM

Hi there,

Quote:

Originally Posted by ask (Post 4561602)
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 (Post 4561602)
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 ...

[X] Doc CPU

ask 01-02-2012 03:33 AM

[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 05:51 AM.