You are not logged in.

#1 2011-01-07 23:26:58

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

mount -o users doesn't work as intended, why not?

I'm trying to modify some of the udev rules in the Arch wiki to work better for my setup. So I have this as /etc/udev/rules.d/11-media-by-label-auto-mount.rules:

BUS!=usb, KERNEL!="sd[a-z]*", GOTO="media_by_label_auto_mount_end"

# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"

# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"

# Global mount options
ACTION=="add", ENV{mount_options}="noatime,users"
# Filesystem-specific mount options
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"

# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"

# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"

# Exit
LABEL="media_by_label_auto_mount_end"

And it mounts usb sticks just fine. Problem is, I still get a permission denied error when trying to unmount them, despite using the "users" mount option, which is supposed to let *any* user unmount the device.

So I tried mounting the stick manually with the users option...

# mount -o users /dev/sdb /mnt

And still got the error on trying to unmount it:

$ umount /dev/sdb
umount: /dev/sdb is not in the fstab (and you are not root)

So it looks like the users option is not working the way the fstab man page says it should. What am I doing wrong here?

Edit: the users mount option works fine for CDs. Is there a way to make it work for USB sticks, or am I just stuck?

Last edited by Gullible Jones (2011-01-07 23:37:01)

Offline

#2 2011-01-08 00:03:11

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: mount -o users doesn't work as intended, why not?

You have to make an entry in fstab for it. (or just use pmount instead)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#3 2011-01-08 00:09:22

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: mount -o users doesn't work as intended, why not?

Thanks... Kind of strange, that. Is there a way to use pmount and give unmount permissions for all users, so that I don't have to do the silly mount-as-a-specific-user thing?

Edit: Oh N/M, just unmounting with pumount works great. Thanks!

Last edited by Gullible Jones (2011-01-08 00:24:58)

Offline

Board footer

Powered by FluxBB