I'm currently trying to write a couple of systemd/udev configuration files that will allow me to automount/unmount MTP Android devices on my Arch Linux laptop. It took me some time, but so far it works pretty well.Now, I would like for any user with fuse permissions to be able to unmount the device. So far, it's only possible for the same user as the one go-mtpfs was started as.I'm well aware that MTP is designed so that you can just unplug the device without consequences, but having an error message pop up when clicking Eject in Nautilus is kind of unexpected and not really nice.I tried the following, but failed :Add myself to the fuse group, start go-mtpfs as root and try to unmount as myselfStart go-mtpfs as the fuse user and group, and try to unmount as myself, also in the fuse groupAny idea? Also, if you have an elegant way to achieve the same thing without having to rely on the fuse group, I'd love to hear about it!systemd service (/etc/systemd/system/android-mtp.service) :[Service]Type=forkingExecStartPre=/bin/mkdir -p /media/AndroidExecStart=/usr/sbin/daemonize -l /var/lock/go-mtpfs.lock /usr/bin/go-mtpfs -allow-other=true /media/AndroidExecStop=/bin/umount /media/AndroidExecStopPost=/bin/rmdir /media/Androidudev rule (/etc/udev/rules.d/99-android-mtp.rules) :# Google Nexus 7 16 Gb Bootloader & recovery modeSUBSYSTEM==usb, ATTR{idVendor}==18d1, ATTR{idProduct}==4e40, MODE=0666 # BootloaderSUBSYSTEM==usb, ATTR{idVendor}==18d1, ATTR{idProduct}==d001, MODE=0666 # Recovery# Google Nexus 7 16 Gb PTP mode (camera)SUBSYSTEM==usb, ATTR{idVendor}==18d1, ATTR{idProduct}==4e43, MODE=0666 # PTP mediaSUBSYSTEM==usb, ATTR{idVendor}==18d1, ATTR{idProduct}==4e44, MODE=0666 # PTP media with USB debug on# Google Nexus 7 16 Gb MTP mode (multimedia device)SUBSYSTEM==usb, ATTR{idVendor}==18d1, ATTR{idProduct}==4e41, MODE=0666 # MTP mediaSUBSYSTEM==usb, ATTR{idVendor}==18d1, ATTR{idProduct}==4e42, MODE=0666 # MTP media with USB debug on# Google Nexus 7 MTP mode : automatic unmount when unplugged (all android versions)ENV{ID_MODEL}==Nexus, ENV{ID_MODEL_ID}==4e41, ACTION==remove, RUN+=/usr/bin/systemctl stop android-mtp.serviceENV{ID_MODEL}==Nexus, ENV{ID_MODEL_ID}==4e42, ACTION==remove, RUN+=/usr/bin/systemctl stop android-mtp.serviceENV{ID_MODEL}==Nexus_7, ENV{ID_MODEL_ID}==4e41, ACTION==remove, RUN+=/usr/bin/systemctl stop android-mtp.serviceENV{ID_MODEL}==Nexus_7, ENV{ID_MODEL_ID}==4e42, ACTION==remove, RUN+=/usr/bin/systemctl stop android-mtp.service# Google Nexus 7 MTP mode : automatic mount when plugged (all android versions)ENV{ID_MODEL}==Nexus, ENV{ID_MODEL_ID}==4e41, ACTION==add, TAG+=systemd, ENV{SYSTEMD_WANTS}=android-mtp.serviceENV{ID_MODEL}==Nexus, ENV{ID_MODEL_ID}==4e42, ACTION==add, TAG+=systemd, ENV{SYSTEMD_WANTS}=android-mtp.serviceENV{ID_MODEL}==Nexus_7, ENV{ID_MODEL_ID}==4e41, ACTION==add, TAG+=systemd, ENV{SYSTEMD_WANTS}=android-mtp.serviceENV{ID_MODEL}==Nexus_7, ENV{ID_MODEL_ID}==4e42, ACTION==add, TAG+=systemd, ENV{SYSTEMD_WANTS}=android-mtp.service
Allow any user in the fuse group to unmount
udev;android;systemd;fuse
The fuse group is intended to indicate who can mount FUSE filesystems. The intent is not that anyone in that group can unmount filesystems mounted by others. Only the user doing the mounting, or root, can unmount the filesystem. You can use sudo to authorize users in the fuse group to run an unmount command as the same user who did the mounting. Run visudo to add a line like:%fuse ALL = (fuse) fusermount -u /media/AndroidWhy aren't you doing the mounting as yourself? That's the usual way to use FUSE.