Announcement

Collapse
No announcement yet.

Automount USB Drive Permissions

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

    Automount USB Drive Permissions

    Hi,

    I have an external USB hard drive, formatted NTFS. I installed the ntfs-3g and ntfs-config packages and ran ntfs-config (all on Kubuntu Feisty, 7.04), after which my USB drive worked for both reading and writing, including automount (Nice!).

    Here's the problem: When it is automounted, the drive is owned as root, and the umask is very permissive. I would like it to mount as me, not root, and for the umask to be something more restrictive, like 0002.

    In other words:

    The drive mounts automatically with permissisons and ownership,
    Code:
    drwxrwxrwx  root  root
    I would like the drive to have permissions,

    Code:
    drwxrwxr-x  myusername myusername
    I tried adding the following line to fstab,

    Code:
    /dev/disk/by-label/Extra3 /media/Extra3 ntfs-3g user,noauto,locale=en_US.utf8,uid=1000,gid=1000,umask=0002,noatime,noadirtime 0 0
    After adding this line, I can mount the drive by running mount as root, but, despite the "user" option above, (1) I cannot run mount as a normal user, and (2) KDE's automounter fails, giving the 'Malformed URL' message. I assume that if I get mount working for normal users, then pmount will work (the manpage for pmount says that it runs mount as the user who ran pmount if it finds the drive in /etc/fstab), and so KDE's automount will work.

    I tried making sure that the ntfs-3g binary was setuid root; e.g.,
    Code:
    sudo chmod u+s /usr/bin/ntfs-3g
    but this didn't seem to change anything.

    Summary: How can I mount an ntfs-3g filesystem as a non-root user? Will this allow me to change the permissions on an automounted usb drive? If not, how do I?

    Any suggestions at all are greatly appreciated.

    #2
    Re: Automount USB Drive Permissions

    Try pmounting it now.
    There's also a "users" options, a bit different from "user", but I'm not sure about what either of them do.

    Also, are you sure you want the umask 0002? You can read about octal permissions in the first part of the chmod man page.
    For external use only.

    Comment


      #3
      Re: Automount USB Drive Permissions

      Originally posted by SheeEttin
      Also, are you sure you want the umask 0002? You can read about octal permissions in the first part of the chmod man page.
      Thanks for pointing that out; I'll take a look at that. Maybe 0664 would be more sensible? At any rate, I'm sure that value can be changed if I can get the larger problems here fixed.

      Originally posted by SheeEttin
      There's also a "users" options, a bit different from "user", but I'm not sure about what either of them do.
      The manpages indicate that 'user' allows only whoever mounted the drive to unmount it, whereas 'users' allows any user to unmount the drive. For my purposes, they should be interchangeable. I've tried both anyway; they give the same results, as expected.

      Originally posted by SheeEttin
      Try pmounting it now.
      Just tried. Nothing happens whatsoever. I don't get any warnings, but, also, no drive is mounted. I get the same behavior with mount. (It makes sense that they do the same thing; the pmount manpage says that, for disks in fstab, pmount just calls mount.)

      So, "mount" fails silently. This behavior is different from trying to "mount" a drive for which neither the "user" nor "users" options are set in fstab; if you try that then you do get a warning from "mount" -- whereas I get nothing at all. (Recall that, if I run mount as root, however, everything works perfectly). This leads me to suspect that the issue is that some program somewhere that's part of the system needs to be setuid root and isn't -- but both ntfs-3g and fusermount are! setuid root! I also added the user I'm trying this as to the 'fuse' group.

      Any other ideas?

      Comment


        #4
        Re: Automount USB Drive Permissions

        The -v option for mount. Perhaps it'll be a bit more... well, verbose.
        For external use only.

        Comment


          #5
          Re: Automount USB Drive Permissions

          I'd tried that as well: Mount had been failing silently even with the '-v' option.

          * Goes to try it again, so that he can check some other debug logs he'd forgotten before (like /var/log/debug) *

          !!!!!!!!

          So, this is strange: It works now!

          I don't think I've changed anything relating to this. Since my last message, I have been messing with unrelated things -- I installed ndiswrapper and tried using that, then got rid of it and installed fwcutter instead; I'd also installed KWifiManager, had some unrelated packages be automatically updated (vi, vim, and some kind of tcp wrappers package), and rebooted a few times -- but didn't think I'd changed anything relevant. This is weird.

          Note: At first, when it magically started working, I could "mount Extra3" but if I tried to run "umount Extra3" I'd be told, "only root can do that." I changed "user" to "users" in fstab, and I can now unmount as well (why the difference? I don't know.)

          Thank you very much for your help! I wish I could give more useful information for future readers of this post about how the problem got fixed. Also, the fact that it started working at random makes me worry that it might stop working at random. If that happens, or if I learn anything, I'll post back here.

          (Thanks again.)

          Comment


            #6
            Re: Automount USB Drive Permissions

            I'm sorry for jumping onto this topic with a problem of my own, but I didn't want to create a new topic for what I believe is a similar problem.

            Basically I have two external HDD's both Freecom Drives. I have one in work and one at home. The one in work I always use with Kubuntu and the one at home I use with XP and Kubuntu whenever I bring my laptop home. Now whenever I plugged it in and turned it on, it would automatically be detected and an icon would appear in the top left, also the same icon would appear in /media (basically it looks like a USB Pen Drive).

            Now recently I got a new computer at home and it has Windows Vista Ultimate on. I was simply trying to copy some music files across using Samba but that was a pain in the neck, so I decided to use the external HDD as I had before to transfer files. Now when I plugged it into my laptop with Kubuntu running, the icon would no longer show up, so basically it wasn't automounting.

            So now to the problem. At the moment, the external HDD is empty using NTFS. I have ntfs-3g and ntfs-config installed. If I use:
            sudo mount -t ntfs /dev/sdb1 /media/FREECOM\ HDD
            It mounts, no icon appears but I have a folder in /media as I asked. Only I can't access it without root permissions. I tried chown, chmod, and even used kdesu konqueror and tried right clicking to change the permissions from there. Absolutely no luck. If I use:
            pmount /dev/sdb1
            It mounts, and a folder sdb1 appears in /media and I can access that as user.

            What I really want to work out is how to get it to work as it used to. So just simply plugging it in and it automounts with the icon appearing in the top left. The HDD in work still works that way. It just seems this one I connect at home to a Vista machine has decided to not work anymore.

            Any help would be appreciated, and I apologise if this is maybe too different from the original topic, but I felt it wasn't maybe different to warrant it's own topic. I'm sure there are plenty enough made that it's hard to keep track of them all.

            Comment


              #7
              Re: Automount USB Drive Permissions

              I had the same problem and here is what I did:

              I opened the System Settings and hit the tab Advanced. I clicked on Disk & Filesystems. I hit the button Administrator Mode and entered my password. I clicked my USB Harddrive and then the Modify button (or right-click and select Modify). A new window will open. At the top there is a drop down menu that should say Automatic. Change it to NTFS - NT File System. The window will now display more options. Type in your mount point if it isn't in there, I made mine /media/usbhd. Also leave Device with the radio button on "by name" with the location. Under Security & Safety, I checked the box next to Writeable. There should be 3 drop down menus. The first two select your user and group. The third I just left be at Root user may enable and disable. Click ok and enable the harddrive. Open Konqueror or what ever and see if you can browse it.

              I still cannot edit, delete, or change permissions. I haven't tried using terminal but at least now I can read my files.

              Comment


                #8
                Re: Automount USB Drive Permissions

                Originally posted by msimoens
                I had the same problem and here is what I did:

                I opened the System Settings and hit the tab Advanced. I clicked on Disk & Filesystems. I hit the button Administrator Mode and entered my password. I clicked my USB Harddrive and then the Modify button (or right-click and select Modify). A new window will open. At the top there is a drop down menu that should say Automatic. Change it to NTFS - NT File System. The window will now display more options. Type in your mount point if it isn't in there, I made mine /media/usbhd. Also leave Device with the radio button on "by name" with the location. Under Security & Safety, I checked the box next to Writeable. There should be 3 drop down menus. The first two select your user and group. The third I just left be at Root user may enable and disable. Click ok and enable the harddrive. Open Konqueror or what ever and see if you can browse it.

                I still cannot edit, delete, or change permissions. I haven't tried using terminal but at least now I can read my files.
                Hey thanks. This worked great. Now the only slight problem was that I was unable to unmount it. Normally, I would just right click and select safely remove. But now I'm getting errors, and trying to sudo unmount which worked before doesn't work since it believes that it is not mounted. Turns out, I had to change that third option from root user may enable and disable to any user may enable and disable. Now it works pretty much like it used to.

                Thanks very much for you help!

                Comment


                  #9
                  Re: Automount USB Drive Permissions

                  Great, now maybe I can adapt this to get my iPod to do the same.

                  That is, of course, after I get the battery replaced... iPods and salt water are not compatible.
                  For external use only.

                  Comment


                    #10
                    Re: Automount USB Drive Permissions

                    Originally posted by msimoens
                    I still cannot edit, delete, or change permissions.
                    http://kubuntuforums.net/forums/inde...86836#msg86836

                    Comment

                    Working...
                    X