TransWikia.com

How to mount vfat drive on Linux with ownership other than root?

Server Fault Asked by Norman Ramsey on January 15, 2021

I’m running into trouble mounting an iPod on a newly upgraded Debian Squeeze.
I suspect either a protocol has changed or I’ve tickled a bug, which I don’t know where to report.

I’m trying to mount the iPod so that I have permission to read and write it.
But my efforts come to nothing:

$ sudo mount -v -t vfat -o uid=32074,gid=6202 /dev/sde2 /mnt
/dev/sde2 on /mnt type vfat (rw,uid=32074,gid=6202)
$ ls -l /mnt
total 80
drwxr-xr-x 2 root root 16384 Jan  1  2000 Calendars
drwxr-xr-x 2 root root 16384 Jan  1  2000 Contacts
drwxr-xr-x 2 root root 16384 Jan  1  2000 Notes
drwxr-xr-x 3 root root 16384 Jun 23  2007 Photos
drwxr-xr-x 6 root root 16384 Jun 19  2007 iPod_Control
$ sudo umount /mnt
$ sudo mount -v -t vfat -o uid=nr,gid=nr /dev/sde2 /mnt     
/dev/sde2 on /mnt type vfat (rw,uid=32074,gid=6202)
$ ls -l /mnt
total 80
drwxr-xr-x 2 root root 16384 Jan  1  2000 Calendars
drwxr-xr-x 2 root root 16384 Jan  1  2000 Contacts
drwxr-xr-x 2 root root 16384 Jan  1  2000 Notes
drwxr-xr-x 3 root root 16384 Jun 23  2007 Photos
drwxr-xr-x 6 root root 16384 Jun 19  2007 iPod_Control

As you see, I’ve tried both symbolic and numberic IDs, but the files persist in being owned by root (and only writable by root).

The IDs are really mine; I’ve had the UID since 1993.

$ id
uid=32074(nr) gid=6202(nr) groups=6202(nr),0(root),2(bin),4(adm),...

I’ve put an strace at http://pastebin.com/Xue2u9FZ, and the mount(2) call looks good:

mount("/dev/sde2", "/mnt", "vfat", MS_MGC_VAL, "uid=32074,gid=6202") = 0

Finally, here’s my kernel version from uname -a:

Linux homedog 2.6.32-5-686 #1 SMP Mon Jun 13 04:13:06 UTC 2011 i686 GNU/Linux

Does anyone know if

  • I should be doing something different, or
  • If there is a workaround, or
  • If this is a bug, where it should be reported?

One Answer

Rebooting the machine made the problem go away.

I think I will leave the question since it seems that it does in fact show how to mount a vfat drive on Linux with ownership other than root. But if someone thinks I should delete the question please let me know.

Answered by Norman Ramsey on January 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP