1

I'm using Debian testing with XFCE as Desktop Environment and Thunar as filemanager. I've an issue regarding the mounting of USB mass storages such as USB flash drive. When I plug in the USB flash drive the icon representing it appears on the desktop; if I double-click it, Thunar mounts it but with root as user and group. Result: I can access the device (as user), but I cannot write on it.

I've checked mount output with two different USB flash drives. I've noticed that the automount is correctly done with the USB flash drive on which the filesystem is created on /dev/sdb (USB flash drive 1), for example; in the other one where I've a /dev/sdb1 partition (USB flash drive 2), XFCE automounting doesn't correctly work and mount the device with root ownership.

USB flash drive 1 mount output:

/dev/sdb on /media/gilberto/3C93-E461 type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=437,iocharset=utf8,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

USB flash drive 2 mount output:

/dev/sdb1 on /media/usb0 type vfat (rw,nosuid,nodev,noexec,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro,user)

Any solution for this issue?

7
  • What's the filesystem on the USB? Is it one that can do chown to change the owner to your user? And is it even mounted read-write (check mount for "rw")?
    – Xen2050
    Feb 5, 2015 at 18:58
  • It is a vfat filesystem. Feb 5, 2015 at 19:30
  • vfat should be able to be written to by a regular user... may need some mount options, man mount should be informative. And what's it mounted as now? i.e. what does mount say for it?
    – Xen2050
    Feb 6, 2015 at 4:36
  • @Xen2050 I've added further information on the question. Feb 6, 2015 at 10:44
  • The fmask & dmask look suspicious, 0022 gives only group & all write permission, no read permission or any use permissions at all... 0660 or 0666 should give read-write permission for user, group, optionally all.
    – Xen2050
    Feb 6, 2015 at 10:53

2 Answers 2

0

Should first check that the drive is being mounted correctly, no error messages or "read-only" type messages in dmesg or /var/log/syslog

Then you probably want to use some mount options like the ones below (from man mount):

Mount options for fat
(Note: fat is not a separate filesystem, but a common part of the msdos, umsdos and vfat filesystems.)

uid=value and gid=value
Set the owner and group of all files. (Default: the uid and gid of the current process.)

umask=value
Set the umask (the bitmask of the permissions that are not present). The default is the umask of the current process. The value is given in octal.

And this might be informative, if the drive is initially writeable but then changes:

If the msdos filesystem detects an inconsistency, it reports an error and sets the file system read-only. The filesystem can be made writable again by remounting it.

Then when the right options are found, you can edit /etc/fstab or use Disks (gnome-disk-utility, though it's not been 100% reliable in the past).


I'm not sure why Thunar (or udisks2) is not mounting the drives properly... looks like the fmask / dmask codes show no user permissions, and/or no read permissions. I'm on Linux Mint XFCE and USB drives with fat "just work"... Adding an entry for each partition's UUID (from sudo blkid) to /etc/fstab should fix it, but shouldn't be necessary. Actually, is there anything strange in that file now?

Checking my Thunar Edit -> Preferences -> Advanced tab - Volume Management checkbox is checked, and when I click the Configure link it goes to the XFCE Settings -> "Removable Drives and Media" where there is nothing checked for any of the tabs (Storage -> Removable Storage, all are unchecked) except for "Play VCD's/DVDs".

Maybe there's a strange setting in there somewhere? Try changing things so they're similar to mine? And if it's not a setting there, maybe udisks/udisks2 is doing something strange on it's own, but I'm not sure how to change that... man udisks/man udisks2 would be the first stop.

5
  • Filesystem is mounted in read-write mode, but with the wrong user/group (root). I'll give more details I've noticed in the question. Feb 6, 2015 at 7:41
  • That's exactly what the uid=value and gid=value options should fix. Just replace "value" with your actual uid (often 1000 for the first user on a Debian system), check your uid with echo $UID or whoami or id or id -u, then mount -o uid=#### ... or mount -o remount,uid=#### ...
    – Xen2050
    Feb 6, 2015 at 9:29
  • 1
    I don't want to use /etc/fstab for removable devices. Furthermore I haven't Disks since I'm using XFCE. I need to found a solution for XFCE automounting. Thank you for your suggestion. Feb 6, 2015 at 10:37
  • I'm using XFCE too, and Disks is installed by default (I think it's in just about every Ubuntu & Mint install, and easily available everywhere else). But I don't use it for this anyway, I use the terminal. If you don't want to type a single mount line in a terminal to even test the problem, that's ok. ttyl!
    – Xen2050
    Feb 6, 2015 at 10:43
  • 1
    I'm able to manually mount the USB sticks. I'd like to solve my issue with the automounting and it doesn't deal with fstab. Feb 6, 2015 at 10:46
0

I encountered the same problem with my Debian desktop and the suggestion by Tara on Bodhi Linux Forums solved it.

Essentially I removed the line including the device /dev/sdb1 in my /etc/fstab and then Thunar started mounting any USB storage devices with my account instead of root. Detection of devices and mounting are taken care of by gvfs and thunar-volman.

2
  • thunar-volman don't have any settings to specify user. Where is it?
    – Anwar
    Oct 3, 2018 at 10:36
  • that is what is very unpleasant to me with Linux - we cannot (system is too complex to dig for most of us) identify root cause and have to stick to magic tricks. btw, looks like link to other forum is no longer working. Jan 20, 2019 at 3:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .