Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: write access for user in usb mounted disk

  1. #1
    Join Date
    Jun 2015
    Location
    Toulouse
    Posts
    133

    Default write access for user in usb mounted disk

    Hello,

    This is an old problem, but so widely spread on the net than after reading tons of pages I couldn't find the real solution :-(

    When I plug in an usb disk (for my last test, formatted ext4), udev mount it to /run/media/<user>, but read only. I want to be able to write to this disk, preferably only for the user.

    Of course I can go root and brute force the permissions, but it should be smarter to trick udisk to do this for me, if possible for any file system.

    any idea?

    thanks
    jdd
    42.3, kde (dolphin)

  2. #2
    Join Date
    Mar 2008
    Location
    Oz
    Posts
    11,731
    Blog Entries
    2

    Default Re: write access for user in usb mounted disk

    I format my usb stick to ext4. Then I mount it using this command (as root):
    Code:
    mount /dev/sdc1 /mnt/sdc1
    Then I run this command as root:
    Code:
    chown yourname:users /mnt/sdc1
    Then I unmount the stick and take it out. From there on when I plug it into my usb slot it automounts for user yourname.
    Of course, use your real name.
    Is that what you wanted?
    Leap 42.3 & 15.1 &KDE
    FYIs from the days of yore

  3. #3
    Join Date
    Mar 2008
    Location
    Oz
    Posts
    11,731
    Blog Entries
    2

    Default Re: write access for user in usb mounted disk

    Sorry. It doesn't actually "automount" by itself. It suggests to mount and I click-accept. (I use KDE.)
    Leap 42.3 & 15.1 &KDE
    FYIs from the days of yore

  4. #4
    Join Date
    Jun 2015
    Location
    Toulouse
    Posts
    133

    Default Re: write access for user in usb mounted disk

    yes, I know that, and it's what I call "brute force" :-)

    But I have lot of USB devices, so this is not that friendly.

    even more, I'm pretty sure I have write access on an other computer, but it may be depending of the file susyem. The udev rule set it to read only, rthere should be possible to have one setting it RW?

    thanks
    jdd

  5. #5
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    16,288

    Default Re: write access for user in usb mounted disk

    UID not you name is the owner. You can have the same name on two computers but not the same UID

  6. #6
    Join Date
    Jun 2015
    Location
    Toulouse
    Posts
    133

    Default Re: write access for user in usb mounted disk

    Quote Originally Posted by gogalthorp View Post
    UID not you name is the owner. You can have the same name on two computers but not the same UID
    the mount point is built dynamically by udev, so no such problem. It is

    [code]
    /run/media/<username>/<diskID>

    jdd

  7. #7
    Join Date
    Sep 2012
    Posts
    7,106

    Default Re: write access for user in usb mounted disk

    Quote Originally Posted by jdd View Post
    udev mount it to /run/media/<user>
    No, it did not.

    Quote Originally Posted by jdd View Post
    The udev rule set it to read only
    No, it did not.

    Quote Originally Posted by jdd View Post
    ... formatted ext4 ...
    But I have lot of USB devices, so this is not that friendly.
    "Doctor, it hurts when I stab myself in the eye".

    If you do not want to manage file access on every individual device, do not use filesystem that persistently stores file access information. Use FAT.

  8. #8
    Join Date
    Jun 2015
    Location
    Toulouse
    Posts
    133

    Default Re: write access for user in usb mounted disk

    ?
    You know better than me what I have on my disk?

    The disk is dynamically mounted on /run/media/<user>/<diskID> which is well under /run/media/...

    permissions are drwxr-xr-x, owner root

    and how do you manage to backup a linux system on FAT disk?, specially with large files?

    but I could use the disk simply changing the folder owner to <user>:users (not what I wanted though)

    I made an other test that may explain the problem, at least partially. I mounted an other usb disk and it was mounted with the user owner and rw, but by fuseblk

    Code:
    lsblk -no name,fstype
    allowed me to see the filesystem is ntfs

    but to backup a linux file system, ntfs is not that good (filename/length problems)

    jdd

  9. #9
    Join Date
    Sep 2012
    Posts
    7,106

    Default Re: write access for user in usb mounted disk

    Quote Originally Posted by jdd View Post
    ?
    You know better than me what I have on my disk?
    I know better than you how Linux works, yes.

    You cannot bypass user access information on ext4 using normal means. Period. This answers your original question. If you now want to discuss how to backup your installation, that's fine, but hardly belongs to this thread.

  10. #10
    Join Date
    Jun 2015
    Location
    Toulouse
    Posts
    133

    Default Re: write access for user in usb mounted disk

    Quote Originally Posted by arvidjaar View Post
    I know better than you how Linux works, yes.

    You cannot bypass user access information on ext4 using normal means. Period. This answers your original question. If you now want to discuss how to backup your installation, that's fine, but hardly belongs to this thread.
    I was answering to you saying I have to use FAT...

    the fact is it's enough to change upper folder owner to solve the problem. In fact the disk was initially written by me with the same UDI, so absolutely no problem.

    In place of making unfriendly remarks, could you explain a bit what bypass is there? I don't ask to overwrite files permissions, only to mount the partition rw... as is done with ntfs, for example. Fuse file system gives me ownership of ntfs disk, why not ext4?

    if you have an answer, please explain...

    jdd

Page 1 of 3 123 LastLast

Posting Permissions

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