Announcement

Collapse
No announcement yet.

External USB HD/partition ownership issue quirk and fix

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    External USB HD/partition ownership issue quirk and fix

    Not really sure if this is a KDE issue or an OS issue, or a ....

    Background:

    Kernel: 2.6.31-21-generic i686 (32 bit)
    Distro: Kubuntu 9.10 karmic
    KDE: 4.4.2
    External HDs: USB 60GB and USB 30GB

    The 60GB drive has a single primary partition formatted as ext3.
    The 30GB drive has a primary partition formatted as fat32, an extended partition with two logical partitions formatted as ext3.
    The 60GB drive had nothing on it. The 30GB drives two ext3 partitions had nothing on them.

    The issue / quirk
    When accessing the 30GB ext3 partitions via Dolphin, I, as the user, had no permissions to the partitions. The same was true of the 60GB single ext3 partition.

    With them mounted (having been accessed by Dolphin), I checked the Permissions > Ownership (User:Group) of the mount points in /media for each of them. All three were root:root.

    Hmm, I said. That isn't right. But I understood what I believe was the cause. Mounting of devices is a root function. These USB HDs are not identified in my fstab file by choice - my PC is a laptop, and I sometimes travel with it and don't take the external USB HDs with me when I do. Mounting of these two HDs is to be done 'on demand' when I have them connected.

    The fix
    I fixed this issue as follows:

    With all three partitions mounted (by Dolphin), I navigated to /media and right-clicked on each of the mount point folders, selected Root Actions > Ownership to... and clicked No, then typed paul:root and clicked OK. Then I when into each partition using Dolphin (under Places). Right-clicking in the display window I created a text file. It could have been any type of file or object, just as long as the user created it.

    Now that a file/object existed in each of the ext3 partitions on the USB HDs that had been created by the user (me), the partitions are properly identified with ownership permissions of paul:root when the partitions are accessed (and thus, 'mounted').

    It appears that if one sets up an external USB HD and has nothing on it, and doesn't identify it for user access in /etc/fstab, that the user wont have access to it when it is accessed (mounted) 'on demand'. I don't believe that this is/was the intended behavior.

    Thoughts, observations, comments are welcome.

    Windows no longer obstructs my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    #2
    Re: External USB HD/partition ownership issue quirk and fix

    Interesting observation!

    That prompted me to pull out my 320GB USB "My Passport" HD and plug it in. On it I had saved my home account for Jaunty and Karmic before I had done a dist-upgrade on each. It seemed like a good time to back up my LL home account.

    What I noticed is that all of the files on my 320GB HD are root:root but all of them have rwx permission for user group AND WORLD!!

    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    Comment


      #3
      Re: External USB HD/partition ownership issue quirk and fix

      Yes, I don't believe that this is proper, and definitely not what one would expect when plugging in/accessing ones USB HDs. Something in the system that controls the mounting of USB HDs isn't written correctly.

      Having all of your backed up files from your ~/ directory identified as owned by root:root isn't a good thing at all!
      Windows no longer obstructs my view.
      Using Kubuntu Linux since March 23, 2007.
      "It is a capital mistake to theorize before one has data." - Sherlock Holmes

      Comment


        #4
        Re: External USB HD/partition ownership issue quirk and fix

        Ya, IF I have to restore I'll need to change root:root to jerry:jerry for 98,576 files (even if it is a simple one line cli)
        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
        – John F. Kennedy, February 26, 1962.

        Comment


          #5
          Re: External USB HD/partition ownership issue quirk and fix

          Do you think that a bug has been discovered here?
          Windows no longer obstructs my view.
          Using Kubuntu Linux since March 23, 2007.
          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

          Comment


            #6
            Re: External USB HD/partition ownership issue quirk and fix

            I definitely think so. When you do a direct copy (I used Dolphin and dragged my home directory to the USB HD) you expect that the files will copy over EXACTLY as they existed in your home directory ... name, group, permissions, type, timestamp, etc..., and for links and sockets as well (which wouldn't copy over!).


            When I copy some files back from the USB HD to my home directory the permissions are changed. Before they were rwx------, after restoration they are rwxrwxrwx.

            At this point I don't know if KDE4 or the kernel is the problem. A test using mc in a konsole may not differentiate because konsole is a kde4 app.

            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
            – John F. Kennedy, February 26, 1962.

            Comment


              #7
              Re: External USB HD/partition ownership issue quirk and fix

              I'll speculate that this issue has something to do with mounting via USB "hotplug". Remember that the USB bus is agnostic -- any user is an entitled user for USB connectivity. There's no way for the hotplug function to know whether the device is "Paul's" or "not Paul's". Partitions mounted with /etc/fstab are a bit more discriminating, according to the mount options there.

              I don't think it's really a bug. I think it's a "feature" of stuff that gets mounted by plugging it in.

              If you will make a folder on the USB hard drive, and assign that folder the user and group permissions that you want, then the access to that folder will be controlled via Linux permissions, not via the hotplug's brainless approach.

              Comment


                #8
                Re: External USB HD/partition ownership issue quirk and fix

                I'll agree with that 'in principle'. Upon further contemplation, I'm sure that all I needed to do once the partition(s) were 'mounted' through access by Dolphin, was to note the mount-point under media, navigate to /media and perform the Root Actions > Ownership to... changing it to paul:root. Creating a file/object is not required.

                But this is, IMO, cause for concern. A normal user would expect to be able to copy/write to their own connected USB HDs - that was my expectation here. After all, while the underlying mounting action is/was performed by 'root', it was the user - me - that initiated that action through Dolphin, and the system should be 'aware' of that fact.

                My user belongs to groups paul adm dialout cdrom plugdev lpadmin admin sambashare, that, and I'm the 'Administrative' user of the system.

                During boot, the external USB HDs are 'seen' but not mounted. This is key, again, IMO. Once the system is fully up, and the user is logged in and the Desktop is loaded, should the user opt to access one of these USB HDs, they would, as I did, open Dolphin and click on one of them. At that point, the system should understand that the user was requesting access to a currently unmounted HD. If that user belongs to the appropriate group, the system should mount the drive with ownership/permissions of user:root. Once mounted, access to existing files/objects would follow the permissions of those files/objects, just as happens everywhere else in the system.

                So I believe that my observed behavior is aberrant - it should not behave as it did.
                Windows no longer obstructs my view.
                Using Kubuntu Linux since March 23, 2007.
                "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                Comment


                  #9
                  Re: External USB HD/partition ownership issue quirk and fix

                  I was going to write something similar to your last post, but you've expressed my views perfectly. The behavior of USB mountings are aberrant.
                  "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                  – John F. Kennedy, February 26, 1962.

                  Comment


                    #10
                    Re: External USB HD/partition ownership issue quirk and fix

                    So if this is a bug, on what platform - launchpad.net or bugs.kde.org - should it be reported?
                    Windows no longer obstructs my view.
                    Using Kubuntu Linux since March 23, 2007.
                    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                    Comment


                      #11
                      Re: External USB HD/partition ownership issue quirk and fix

                      Originally posted by Snowhog

                      Once the system is fully up, and the user is logged in and the Desktop is loaded, should the user opt to access one of these USB HDs, they would, as I did, open Dolphin and click on one of them. At that point, the system should understand that the user was requesting access to a currently unmounted HD. If that user belongs to the appropriate group, the system should mount the drive with ownership/permissions of user:root.
                      Snowhog, I think your expectation is based upon your use case, but there are other use cases where it won't work. What if a Kubuntu system is in a classroom and has 25 users? Somebody plugs in an external USB hard drive (recently stolen from your house ) and uses Dolphin to access it. What permissions should be expected?

                      Hint: if there is a directory on that drive, with permissions set to paul:root, who gets access to it if there's no paul user on that system?

                      Comment


                        #12
                        Re: External USB HD/partition ownership issue quirk and fix

                        Based on what I know about external media and the general take it any where and use it on any machine, I do agree with Dibl on this. That function is by design. I think that is why some of these external media providers now have encryption software bundled with them.

                        Comment


                          #13
                          Re: External USB HD/partition ownership issue quirk and fix

                          Originally posted by MoonRise
                          Based on what I know about external media and the general take it any where and use it on any machine, I do agree with Dibl on this. That function is by design. I think that is why some of these external media providers now have encryption software bundled with them.
                          This is exactly how I want all my externals to be viewed... accessible by anyone, since they are my backups and if my system (or even me!) dies I certainly want my wife to be able to access all our photos, etc. from her windows machine.

                          I am really being irritated by permissions (and in particular, "executable" files) these days with my NAS/Samba/Windows, so I appreciate the discussion here.

                          Comment


                            #14
                            Re: External USB HD/partition ownership issue quirk and fix

                            Originally posted by dibl
                            .....
                            Snowhog, I think your expectation is based upon your use case, but there are other use cases where it won't work. What if a Kubuntu system is in a classroom and has 25 users? Somebody plugs in an external USB hard drive (recently stolen from your house ) and uses Dolphin to access it. What permissions should be expected?

                            Hint: if there is a directory on that drive, with permissions set to paul:root, who gets access to it if there's no paul user on that system?
                            Answer: NO ONE except root. If "paul" didn't mount it why should anyone else have access to it if they cannot log into paul's account?
                            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                            – John F. Kennedy, February 26, 1962.

                            Comment


                              #15
                              Re: External USB HD/partition ownership issue quirk and fix

                              Originally posted by GreyGeek

                              Answer: NO ONE except root. If "paul" didn't mount it why should anyone else have access to it if they cannot log into paul's account?
                              There ya go, GG! That is correct.

                              But, equally true, any of the 25 legitimate users can open the device itself (not the folder), right? Why? Because it's just a USB storage device, and anyone who can log on to the computer, and is a member of the default groups, can plug in a USB storage device and have at it. The device itself does not have permissions that are specific to any given user.

                              Comment

                              Working...
                              X