4

I've "solved" the following problem, but not in a desirable way.

First, mounting exFAT file systems in Linux was truly as simple as this site says.

The catch is, "as long as you are root."

A user would like to plug in his exFAT file system anytime, but attempting to do so results in:

mount.exfat /dev/sdc1 /media/exfat-device
ERROR: failed to open `/dev/sdc1'

This works as root, but I was able to solve this so that a user can mount it by adding the following line to fstab:

/dev/sdc1 /media/exfat-device exfat-fuse defaults 0 0

However, this is not desirable because it hardcodes sdc1 which assumes (incorrectly) that everything detected as sdc1 will always be exFAT. As an example I connected another non-exFAT drive which gives me no problems, and it's identified as sdc. Then I connect my exFAT device, which becomes sdd, making the fstab addition worthless.

What do I need to do, without giving the user any sudo privileges or elevated access whatsoever, so that any user can connect an exFAT device to that particular machine and read/write to it?

Totor
  • 19,302
  • 17
  • 75
  • 102
CptSupermrkt
  • 1,492
  • 5
  • 16
  • 26
  • 1
    Which distro are you using? I haven't used exFAT yet, but shouldn't most distros just automount any devices that are plugged in if they understand the filesystem? – Martin von Wittich Jan 29 '14 at 15:41
  • Apologies, I should have mentioned that. This is RHEL6, which doesn't have exFAT support out of the box. The link in my message details how to add it (which works great, but only as root). – CptSupermrkt Jan 29 '14 at 15:43
  • Hm, I guess that the automounter probably doesn't know about exFAT then and therefore won't automatically mount exFAT devices. Maybe there's some kind of udev rule that one could add to fix that? I'm afraid I don't know how automounters work, so I can't be of more help. – Martin von Wittich Jan 29 '14 at 15:55
  • https://code.google.com/p/exfat/wiki/HOWTO says that you need `util-linux(-ng)` >= 2.18. Maybe the installed version on RHEL6 is too old? – Martin von Wittich Jan 29 '14 at 15:58
  • Nice find. Indeed, RHEL6 supports up to 2.17 :/ So close! – CptSupermrkt Jan 29 '14 at 16:12

2 Answers2

4

Most distributions have a command called by blkid. blkid will give you a unique identifier for each drive attached to you linux box. Fstab can uses this identifier, replace the /dev/sdc1 with UUID=XXXXXXXXXXXXX. This means that regardless of the user-space designation (e.g. sdc1 scb2 et cetera) your OS will mount it correctly.

HalosGhost
  • 4,732
  • 10
  • 33
  • 41
Eric Smith
  • 41
  • 2
1

Another option is to give the drive a label and put that into /etc/fstab

e.g.

exfatlabel /dev/sdc1 EXTERNAL

nano /etc/fstab

LABEL=EXTERNAL   /mnt/external    exfat-fuse *options*   0 0
Anthon
  • 78,313
  • 42
  • 165
  • 222
Joe S.
  • 11
  • 2