[opensuse] How do I mount USB drive world writable using device notifier?
Hello - I haven't gotten an answer from the KDE mail list, so guess I will try here also.. I have an issue which is a bit annoying to work around, so would like to find a more reasonable solution. My wife and I have laptops running openSuSE 11.2 and 11.3, KDE 4.4.4 and KDE 4.5 We both use an external USB drives formatted with a FAT32 file system and often want to send pictures or other files back and forth to store on these external drives. Right now, we cannot do this directly, though we can navigate to the other's USB drive and see files on it. I use both Samba and autofs to mount file systems from each other's laptop. What we can do is to transfer files to some other directory, such as /tmp and then locally transfer the files from /tmp to the USB drive. A PITA sometimes.... It appears that the USB drive is being mounted with rw permissions for the owner only, and only r permissions for groups and others. I suspect that we need to set the permissions of the mount point to be rw for everyone? We use the KDE device notifier to handle the mounting of the USB drives, but I am unable to figure out how to change the default permissions. Internet searches reveal I am not the only one confronted with this problem, but so far I have not been able to find an openSuSE oriented solution... Any ideas? Thanks in advance for any offers of help and advice! Marc... -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Marc Chamberlin said the following on 02/04/2011 02:58 AM:
It appears that the USB drive is being mounted with rw permissions for the owner only, and only r permissions for groups and others. I suspect that we need to set the permissions of the mount point to be rw for everyone? We use the KDE device notifier to handle the mounting of the USB drives, but I am unable to figure out how to change the default permissions.
I'm a bit confused as to what you are asking, mentioning samba cross mounting, as well as USB files. So I'm going to focus on this paragraph. The way I see the USB file system support working under OpenSuse 2.6.3x with relevant lines in /etc/fstab is that if the USB stick is there at boot is is mounted as owned by root. If not, if you insert it later, the UDEV rules apply, and its owned by ... ME!, running KDE. Well it helps that I have configured the device notifier on my bottom panel to deal with it by name. YMMV It here I get confused about what you are saying. You seem to be saying that you are mounting the USB stick locally then exporting it via SAMBA. Is that right? You seem to be saying that because the files are marc/users/-rw-r--r-- you have a problem with two-way transfer. How is this different from if you used /home/marc/exports/ where you set the files to be -rw-rw-rw- and configured SAMBA to allow access there? Or added that directory to /etc/exports for NFS, which is a LOT simpler. I do a lot of 'transfer' between machines. But most of it is done using NFS mounts. If you are both running openSuSE why not use NFS instead of SAMBA? The nice thing about NFS is that you can set it up so many convenient (and inconvenient) ways. This includes dealing with the target being off-line and it also deals with ID mapping. See idmapd. I can see how NFS might be strange to Windows people but it grew up with *NIX and uses patterns of behaviour and layers of functionality in a way that "we" are used to, even if they seem as odd to Windows people as their practices are to "us". I do have an old Windows machine, one of my father's old laptops fr the few times I need IE or something archaic. In those situations I use the USB stick - after all, who wants to put Windows on the 'Net without a lot of patching and protection (and isn't avoiding all that pain why we use Linux?). Unlike the Linux file systems the windows file system on the USB stick has no encoded ownership. :-) So I took the risk of putting that old Windows box on the internal net (nice to have a firewall) and setting up SAMBA and a workgroup. My, this is complicated compared to NFS! But it seems that you do have control over access, provided the SAMBA server can access in that mode. So if I'm exporting /home/anton/sambaexports/ and that is -r-------- then tough luck! So it seems to me that if you exporting /media/USBSTICK/ which is marc/root/xrw-r-xr-x then ... Well I find this: http://www.cyberciti.biz/tips/how-do-i-set-permissions-to-samba-shares.html which says <quote> (a) Linux system permissions take precedence over Samba permissions. For example if a directory does not have Linux write permission, setting samba writeable = Yes (see below) will not allow to write to shared directory / share. </quote> Well, coming from the Linux world that seems reasonable to me :-) I wouldn't want a Windows thing to subvert my access permissions. All this being said, if you insist on using SAMBA to transfer files between two Linux machines instead of using NFS or rsync, and want to make the usb stick mount with different permissions, then the place to make the change is in /etc/fstab You should have a line like usbfs /proc/bus/usb usbfs noauto,defaults 0 0 If you insist on not using NFS or rsync, which is the "Linux Way" and insist on using a Windows tool to transfer between two similar Linux machines, than this is the line to change. If you read the man page for mount and look for the options for the FAT file system. You will see mention of various mask options. You can use those values instead of "defaults" I don't think this is a good thing as it is a global setting. I think using /home/marc/exports and NFS is both simpler and safer. I'm sure there is a way to set the udev rules to identify a specific stick and treat it specially, but again I don't think that is a 'clean' approach. NFS or rsync is so much simple and so less disruptive to the configuration. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Marc Chamberlin said the following on 02/04/2011 02:58 AM:
It appears that the USB drive is being mounted with rw permissions for the owner only, and only r permissions for groups and others. I suspect that we need to set the permissions of the mount point to be rw for everyone? We use the KDE device notifier to handle the mounting of the USB drives, but I am unable to figure out how to change the default permissions. I'm a bit confused as to what you are asking, mentioning samba cross mounting, as well as USB files. So I'm going to focus on this paragraph. Thanks Anton for your reply. I can see how this was confusing, but I am
On 2/4/2011 5:07 AM, Anton Aylward wrote: trying to be thorough because I have no idea where the trouble may lie and I am NOT a Linux guru by any means. So let me try to be more precise and give an example. Keep in mind that this is a SOHO network, inside my house, and I tend to get tired of all the obtuse security measures provided by Linux that I don't need, can't understand, or want to deal with... I simply want easy to use computers that my wife in particular can understand, and me too! That said, I use Samba to export the root directory / as a share named slash on each of our laptops. (and desktops as well) With Samba I allow guest access, make it writable and browseable. Using autofs, I then automatically mount these exported shares on each system at /mnt/auto/computerName/slash This gives me complete access to the entire file system on each computer within our network, from any other computer within our network. (and I know, some people are going to groan about this, but I get so sick and tired of dealing with Linux security measures (Windoz too) that I simply give up and just tend to try and defeat it as much as I can!) Anywise, after we have our laptops up and running, we will plug in our external USB drives, and use the KDE device notifier to mount them. They get mounted at - /media/MyPassport for example. There is nothing in our /etc/fstab that defines this mounting AFAIK, though some of what is in fstab is obtuse to me. And I have no idea why the /media directory was chosen as the place where to mount our USB drives, it was only through using grep that I was able to figure out that this was where it got mounted. The device notifier doesn't appear to tell me, like I would have expected it should. Other than what the partitioner defined, when I installed openSuSE, nothing else has been added to the fstab files. In your reply you referred to one line in the fstab file that I also found in mine - usbfs /proc/bus/usb usbfs noauto 0 0 so I did some experiments, but this is somewhat obtuse to me also, so not sure if I did these right - usbfs /proc/bus/usb usbfs noauto,defaults 0 0 and from what I could grok out of the man page for mounting usbfs file systems, I took the following wild guess (and various permutations) usbfs /proc/bus/usb usbfs noauto,devmode=0777,busmode=0777,listmode=0777 0 0 None of which worked, So I suspect, from your description, that the UDEV rules apply (what ever those are) when these USB drives are plugged in. Now, what I want to be able to do is something like the following, to copy files from my laptop to my wife's USB drive - cp *.jpg /mnt/auto/wifesLaptop/slash/media/MyPassport/Documents/Pictures or for my wife to be able to use Dolphin to simply drag and drop pictures from her laptop to my USB drive using similar paths... But as I mentioned, these operations fail, and as far as I can determine this is due to yet another layer of obscure Linux security that is setting the permissions of the USB drive, when it is mounted - marc@marcslaptop:/media> ll total 32 drwxr-xr-x 11 marc root 32768 1969-12-31 16:00 My Passport and my guess is that this needs to have this permission instead - drwxrwxrwx These USB drives are formatted as FAT32 so as to allow them to be used on Windoz machines as well, and that may be part of the problem, I don't know, and as I said I am guessing a lot. Linux security simply eludes me so all I can do is experiment and try... I cannot chmod the permissions of /media/MyPassport like I can for most other files/directories, and I have no idea how or why this particular default for permissions was established. (this sort of inconsistencies with Linux security is what drives me wild and is so frustrating, if I had my way I would start at the root dir and chmod everything to 0x777 and be done with it, but I found out the hard way that also breaks a lot of things! sigh... ) Hence my request for help... I will insert some comments within the rest of your comments, (much appreciated, though I did not understand some of it) but hopefully you have enough info now so that we are on the same page... Again thanks in advance for any and all offers of help! Marc...
The way I see the USB file system support working under OpenSuse 2.6.3x with relevant lines in /etc/fstab is that if the USB stick is there at boot is is mounted as owned by root.
If not, if you insert it later, the UDEV rules apply, and its owned by ... ME!, running KDE. Well it helps that I have configured the device notifier on my bottom panel to deal with it by name. YMMV I don't mount the USB drive during boot, but later. Ownership shows it is owned by me, with root as the group. See above...
It here I get confused about what you are saying.
You seem to be saying that you are mounting the USB stick locally then exporting it via SAMBA. Is that right? No, I don't think so, at least I don't export the USB drive directly via Samba... but indirectly by exporting the containing filesystem. You seem to be saying that because the files are marc/users/-rw-r--r-- you have a problem with two-way transfer.
How is this different from if you used /home/marc/exports/ where you set the files to be -rw-rw-rw- and configured SAMBA to allow access there? I don't follow you here, how do I configure Samba to use the exports file? Or added that directory to /etc/exports for NFS, which is a LOT simpler.
I do a lot of 'transfer' between machines. But most of it is done using NFS mounts.
If you are both running openSuSE why not use NFS instead of SAMBA?
The nice thing about NFS is that you can set it up so many convenient (and inconvenient) ways. This includes dealing with the target being off-line and it also deals with ID mapping. See idmapd.
I can see how NFS might be strange to Windows people but it grew up with *NIX and uses patterns of behaviour and layers of functionality in a way that "we" are used to, even if they seem as odd to Windows people as their practices are to "us".
I do have an old Windows machine, one of my father's old laptops fr the few times I need IE or something archaic. In those situations I use the USB stick - after all, who wants to put Windows on the 'Net without a lot of patching and protection (and isn't avoiding all that pain why we use Linux?).
Unlike the Linux file systems the windows file system on the USB stick has no encoded ownership. :-)
So I took the risk of putting that old Windows box on the internal net (nice to have a firewall) and setting up SAMBA and a workgroup. My, this is complicated compared to NFS! But it seems that you do have control over access, provided the SAMBA server can access in that mode. I think you are arguing not to use Samba and use NFS instead, and I think I am also hearing you argue against putting Windows machines on my network. For my situation, that would be impossible, I also have machines running Windows and it is absolutely necessary that they be on my network as well. It is also necessary that I be able to transfer files to/from Linux and Windows machines. I have not studied NFS and have no idea if file systems exported by it can be seen by Windows machines, but I do know that Samba accomplishes that. Hence my usage of Samba to define shares to be exported, and autofs to mount those shares. So if I'm exporting /home/anton/sambaexports/ and that is -r-------- then tough luck!
So it seems to me that if you exporting /media/USBSTICK/ which is marc/root/xrw-r-xr-x then ...
Well I find this: http://www.cyberciti.biz/tips/how-do-i-set-permissions-to-samba-shares.html
which says
<quote> (a) Linux system permissions take precedence over Samba permissions. For example if a directory does not have Linux write permission, setting samba writeable = Yes (see below) will not allow to write to shared directory / share. </quote>
Well, coming from the Linux world that seems reasonable to me :-) I wouldn't want a Windows thing to subvert my access permissions.
All this being said, if you insist on using SAMBA to transfer files between two Linux machines instead of using NFS or rsync, and want to make the usb stick mount with different permissions, then the place to make the change is in /etc/fstab
You should have a line like
usbfs /proc/bus/usb usbfs noauto,defaults 0 0 I experimented some with this configuration statement in my fstab files, see above, but so far no joy in finding a solution... Yes in this particular case, between my wife's laptop and mine we both are using Linux, but my work requires Windozs systems, so I also have Windozs computers on my network so as to be able to develop software for Windoz... If you insist on not using NFS or rsync, which is the "Linux Way" and insist on using a Windows tool to transfer between two similar Linux machines, than this is the line to change. If you read the man page for mount and look for the options for the FAT file system. You will see mention of various mask options. You can use those values instead of "defaults" Don't insist, just don't think I have a choice. If you can tell me that NFS will work with Windoz systems as well, then I will take the time to learn it and figure out how. But considering my experience with Microsoft's hard headedness about doing things their way and not giving a damn about standards, I will be surprised that they can be compatible with a file management system that they did not invent... Maybe there are some open source third party tools? Another question I might ask is, is it possible to run both Samba and NFS at the same time? (I am not sure I like that answer, too much maintenance and learning, but perhaps it might partially solve my problem...) I don't think this is a good thing as it is a global setting. I think using /home/marc/exports and NFS is both simpler and safer.
I'm sure there is a way to set the udev rules to identify a specific stick and treat it specially, but again I don't think that is a 'clean' approach. NFS or rsync is so much simple and so less disruptive to the configuration.
Perhaps, wish I could be a Linux purist, but sadly I live on a planet that I sometimes think was a mistake and have to compromise a lot! LOL Marc.. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 04/02/11 20:16, Marc Chamberlin wrote:
Thanks Anton for your reply. I can see how this was confusing, but I am trying to be thorough because I have no idea where the trouble may lie and I am NOT a Linux guru by any means. So let me try to be more precise and give an example. Keep in mind that this is a SOHO network, inside my house, and I tend to get tired of all the obtuse security measures provided by Linux that I don't need, can't understand, or want to deal with... I simply want easy to use computers that my wife in particular can understand, and me too!
That said, I use Samba to export the root directory / as a share named slash on each of our laptops. (and desktops as well) With Samba I allow guest access, make it writable and browseable.
Using autofs, I then automatically mount these exported shares on each system at
/mnt/auto/computerName/slash
This gives me complete access to the entire file system on each computer within our network, from any other computer within our network. (and I know, some people are going to groan about this, but I get so sick and tired of dealing with Linux security measures (Windoz too) that I simply give up and just tend to try and defeat it as much as I can!)
Anywise, after we have our laptops up and running, we will plug in our external USB drives, and use the KDE device notifier to mount them. They get mounted at - /media/MyPassport for example. There is nothing in our /etc/fstab that defines this mounting AFAIK, though some of what is in fstab is obtuse to me. And I have no idea why the /media directory was chosen as the place where to mount our USB drives, it was only through using grep that I was able to figure out that this was where it got mounted. The device notifier doesn't appear to tell me, like I would have expected it should. Other than what the partitioner defined, when I installed openSuSE, nothing else has been added to the fstab files.
In your reply you referred to one line in the fstab file that I also found in mine -
usbfs /proc/bus/usb usbfs noauto 0 0
so I did some experiments, but this is somewhat obtuse to me also, so not sure if I did these right -
usbfs /proc/bus/usb usbfs noauto,defaults 0 0
and from what I could grok out of the man page for mounting usbfs file systems, I took the following wild guess (and various permutations)
usbfs /proc/bus/usb usbfs noauto,devmode=0777,busmode=0777,listmode=0777 0 0
None of which worked, So I suspect, from your description, that the UDEV rules apply (what ever those are) when these USB drives are plugged in.
Now, what I want to be able to do is something like the following, to copy files from my laptop to my wife's USB drive -
cp *.jpg /mnt/auto/wifesLaptop/slash/media/MyPassport/Documents/Pictures
or for my wife to be able to use Dolphin to simply drag and drop pictures from her laptop to my USB drive using similar paths... But as I mentioned, these operations fail, and as far as I can determine this is due to yet another layer of obscure Linux security that is setting the permissions of the USB drive, when it is mounted -
marc@marcslaptop:/media> ll total 32 drwxr-xr-x 11 marc root 32768 1969-12-31 16:00 My Passport
and my guess is that this needs to have this permission instead - drwxrwxrwx These USB drives are formatted as FAT32 so as to allow them to be used on Windoz machines as well, and that may be part of the problem, I don't know, and as I said I am guessing a lot. Linux security simply eludes me so all I can do is experiment and try... I cannot chmod the permissions of /media/MyPassport like I can for most other files/directories, and I have no idea how or why this particular default for permissions was established. (this sort of inconsistencies with Linux security is what drives me wild and is so frustrating, if I had my way I would start at the root dir and chmod everything to 0x777 and be done with it, but I found out the hard way that also breaks a lot of things! sigh... ) Hence my request for help...
I will insert some comments within the rest of your comments, (much appreciated, though I did not understand some of it) but hopefully you have enough info now so that we are on the same page... Again thanks in advance for any and all offers of help!
Marc... Does anyone know if Samba actually allows sharing across multiple filesystems? I know NFS doesn't.
Regards, Tejas -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 04/02/11 23:33, Tejas Guruswamy wrote:
On 04/02/11 20:16, Marc Chamberlin wrote:
Thanks Anton for your reply. I can see how this was confusing, but I am trying to be thorough because I have no idea where the trouble may lie and I am NOT a Linux guru by any means. So let me try to be more precise and give an example. Keep in mind that this is a SOHO network, inside my house, and I tend to get tired of all the obtuse security measures provided by Linux that I don't need, can't understand, or want to deal with... I simply want easy to use computers that my wife in particular can understand, and me too!
That said, I use Samba to export the root directory / as a share named slash on each of our laptops. (and desktops as well) With Samba I allow guest access, make it writable and browseable.
Using autofs, I then automatically mount these exported shares on each system at
/mnt/auto/computerName/slash
This gives me complete access to the entire file system on each computer within our network, from any other computer within our network. (and I know, some people are going to groan about this, but I get so sick and tired of dealing with Linux security measures (Windoz too) that I simply give up and just tend to try and defeat it as much as I can!)
Anywise, after we have our laptops up and running, we will plug in our external USB drives, and use the KDE device notifier to mount them. They get mounted at - /media/MyPassport for example. There is nothing in our /etc/fstab that defines this mounting AFAIK, though some of what is in fstab is obtuse to me. And I have no idea why the /media directory was chosen as the place where to mount our USB drives, it was only through using grep that I was able to figure out that this was where it got mounted. The device notifier doesn't appear to tell me, like I would have expected it should. Other than what the partitioner defined, when I installed openSuSE, nothing else has been added to the fstab files.
In your reply you referred to one line in the fstab file that I also found in mine -
usbfs /proc/bus/usb usbfs noauto 0 0
so I did some experiments, but this is somewhat obtuse to me also, so not sure if I did these right -
usbfs /proc/bus/usb usbfs noauto,defaults 0 0
and from what I could grok out of the man page for mounting usbfs file systems, I took the following wild guess (and various permutations)
usbfs /proc/bus/usb usbfs noauto,devmode=0777,busmode=0777,listmode=0777 0 0
None of which worked, So I suspect, from your description, that the UDEV rules apply (what ever those are) when these USB drives are plugged in.
Now, what I want to be able to do is something like the following, to copy files from my laptop to my wife's USB drive -
cp *.jpg /mnt/auto/wifesLaptop/slash/media/MyPassport/Documents/Pictures
or for my wife to be able to use Dolphin to simply drag and drop pictures from her laptop to my USB drive using similar paths... But as I mentioned, these operations fail, and as far as I can determine this is due to yet another layer of obscure Linux security that is setting the permissions of the USB drive, when it is mounted -
marc@marcslaptop:/media> ll total 32 drwxr-xr-x 11 marc root 32768 1969-12-31 16:00 My Passport
and my guess is that this needs to have this permission instead - drwxrwxrwx These USB drives are formatted as FAT32 so as to allow them to be used on Windoz machines as well, and that may be part of the problem, I don't know, and as I said I am guessing a lot. Linux security simply eludes me so all I can do is experiment and try... I cannot chmod the permissions of /media/MyPassport like I can for most other files/directories, and I have no idea how or why this particular default for permissions was established. (this sort of inconsistencies with Linux security is what drives me wild and is so frustrating, if I had my way I would start at the root dir and chmod everything to 0x777 and be done with it, but I found out the hard way that also breaks a lot of things! sigh... ) Hence my request for help...
I will insert some comments within the rest of your comments, (much appreciated, though I did not understand some of it) but hopefully you have enough info now so that we are on the same page... Again thanks in advance for any and all offers of help!
Marc...
Does anyone know if Samba actually allows sharing across multiple filesystems? I know NFS doesn't.
Regards, Tejas
Some searching tells me one possibility is that the hal/automounter default permissions for disks mounted in /media don't play well with NFS/Samba. As a test, try mounting the usb stick somewhere else (/mnt?) manually, and then see if the exported share is accessible as you expect. Regard, Tejas -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 2/7/2011 12:47 AM, Tejas Guruswamy wrote:
On 04/02/11 23:33, Tejas Guruswamy wrote:
<stuff snipped>
Does anyone know if Samba actually allows sharing across multiple filesystems? I know NFS doesn't.
Regards, Tejas
Some searching tells me one possibility is that the hal/automounter default permissions for disks mounted in /media don't play well with NFS/Samba. As a test, try mounting the usb stick somewhere else (/mnt?) manually, and then see if the exported share is accessible as you expect.
Regard, Tejas
Tejas - Thank you for replying. I tried to mount the usb drive on /mnt using the following command, on my laptop, running openSuSE11.3 - mount -t auto /dev/sdc1 /mnt/usbdrive -o rw,nodev,noexec and I can access to usb drive without problems, locally from my laptop. I then added the following list to /etc/exports /mnt/usbdrive 192.168.2.0/255.255.255.0(rw,root_squash,sync,no_subtree_check) and restarted the nfs server - rcnfsserver restart On another Linux system, running openSuSE11.2 I set up the following for autofs - in auto.master I added - /mnt/nfs/marcslaptop /etc/auto.marcslaptop.nfs and in auto.marcslaptop.nfs I added MyPassport -rw,soft,intr,timeo=50 marcslaptop:/mnt/usbdrive then restarted the autofs server - rcautofs restart Now, when I try to execute the following command - ls /mnt/nfs/marcslaptop/MyPassport the command hangs until the timeout period expires. The following error is reported - ls: cannot open directory MyPassport/: No such file or directory Incidentally, once I have added the configuration for MyPassport to my auto.marcslaptop.nfs, I can no longer access any other directory that I have exported from marcslaptop either, and added to auto.marcslaptop.nfs to be auto mounted. I get the same timeout regardless of what directory I try to reach. Some additional things I have observed - 1. Removing the "offending" line for MyPassport, from auto.marcslaptop.nfs and restarting the autofs server, does not recover the ability to access other directories either. The only way to recover, that I have found, is to reboot my system. And then, without the configure line for MyPassport, from auto.marcslaptop.nfs, everything else works fine and I can access other directories that I have exported/imported form marcslaptop. 2. Once an attempt has been made to access my USB drive, across the network via an NFS autofs mount point, I can no longer umount the USB drive unless I stop the nfsserver first. That probably is an OK model, but umount does not give any valid hint that the reason it cannot unmount the USB drive is because the nfsserver is still running, and had exported the drive (and perhaps because someone had tried to mount it from across the network). This really leaves the user in the dark and does not guide him towards the solution of unmounting the USB drive. IMHO that is a bad oversight on the designers part.... 3. The KDE Systems Settings > Advance > Removable Devices configuration tool has a strange funny going on. For some odd reason, I cannot uncheck the "Enable automatic mounting of removable media" setting. I uncheck it, the tool thinks about it for a moment, then automatically rechecks the setting and turns it back on! But if I uncheck everything else, then at least KDE is not automatically mounting my USB drive at /media on me. So weird, but easily worked around.... Marc.. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Anton Aylward
-
Marc Chamberlin
-
Tejas Guruswamy