Page 2 of 2 FirstFirst 12
Results 11 to 11 of 11

Thread: autofs mounting usb as root only

  1. #11
    Join Date
    Dec 2009
    Beans
    6,561

    Re: autofs mounting usb as root only

    I admit I'm getting confused by all this.

    [1] I don't know why autofs is getting referenced in all this.

    The way an external usb storage drive automatically mounts is in fact an auto-mounting process but it's not an "automounter" like the old autofs process or the systemd equivalent. It's a udisks / udev thing.

    I just inserted an ext4 formatted USB stick into my system. If I run the mount command I see it's using udisks:
    tester@ub2004:~$ mount | grep udisks
    /dev/sde1 on /media/tester/USBExt4 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
    [2] I don't understand the write access inability you are experiencing.

    If your device is mounting to /media/me/UUID I can understand why everyone but "me" cannot write or even get access to /UUID but it shouldn't pose a problem for "me" - as long as the permissions on/UUID itself allow it.

    I do have a question though and it's about the contents of these USB storage devices. What's on them? Is it just a bunch of data?

    The reason I ask is because if you want access by every local user to these devices you really only have two alternatives here:

    *** Create an fstab entry for every single external USB HDD you come across and make sure the mount point is anywhere other than under /media/$USER/

    *** OR if there can be any number of random external devices use bindfs to create a view that gives write access to everyone regardless of the Linux permissions.

    Example:

    Create a new mount point .. say at /USBMedia

    Install bindfs:
    Code:
    sudo apt install bindfs
    Temporally remount /media to /USBMedia with a set of permissions that allows anyone write access - something like this:
    Code:
    sudo bindfs -o perms=0777 /media /USBMedia
    Whenever a USB HDD is attached to the system it will mount twice:

    Once under /media/tester which you will use to unmount the device.

    And again - as a "view" - under /USBMedia/tester where the permissions allow write access to all since that is how you defined it ( perms=0777 ). Note: These permissions are immutable and are the same throughout the "view".

    To undo the bindfs remount:
    Code:
    sudo umount /USBMedia
    An equivalent entry in fstab will have this "view" remount happen at every boot if it satisfies your use case. This bindfs method may not be applicable or desirable in your situation since I don't know how these external HDD's are being used.
    Last edited by Morbius1; July 1st, 2021 at 01:08 PM.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •