4

How do I set GID/UID and mode bits assigned to the directory in /media, to which my USB drive is auto-mounted when I plug it in (i.e. to the directory, which represents the drive itself, e.g. /media/MyUSBDriveLabel)?

I'm trying to make an auto-mounted drive accessible by several users, belonging to the same group. Bu default I'm getting it accessible to the current user only:

$ ls -ld /media/MyUSBDriveLabel
drwx------ 18 user group 16384 1970-01-01 03:00 MyUSBDriveLabel

while I'd like to get something like

drwxrwx--- 18 user sharedgroup 16384 1970-01-01 03:00 MyUSBDriveLabel

Is it doable with Nautilus's auto-mount or should I use some other auto-mount solution?

Flyk
  • 1,480

1 Answers1

1

A very similar question has a udev-based answer. Try taking that solution, but replace the MODE setting with a USER and/or GROUP setting.

  • Or maybe not. It seems that answer will let you control the owner of the device file, not the owner of the mounted filesystem. – Jean-Paul Calderone Aug 01 '11 at 16:46
  • The only other answer I've been able to find involves recompiling udisks-daemon (which is what actually does the mount on Ubuntu 10.10, as far as I can tell - not nautilus itself, despite nautilus having support for doing the mount itself). This isn't a very satisfying solution, though. – Jean-Paul Calderone Aug 01 '11 at 16:47
  • Nope, udev's RUN option is the way to go. One cane issue a mount command inside that option. See: http://askubuntu.com/questions/54321/how-do-i-give-multiple-users-access-to-a-windows-ntfs-partition/54324#54324 – con-f-use Aug 01 '11 at 16:50
  • Ooh. Following a link to https://wiki.archlinux.org/index.php/Udev#Mount_under_.2Fmedia.3B_use_partition_label_if_present from http://askubuntu.com/questions/30762/is-setting-default-mount-options-for-udisks-really-not-possible suggests that udev can control the mount options using something like ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002" which should actually affect the mounted filesystem in the usual way. – Jean-Paul Calderone Aug 01 '11 at 16:50
  • Or the arch way. That is untested though :D – con-f-use Aug 01 '11 at 16:52