You are not logged in.
I would just like to be able to automount my external devices on /media/DEVICE_NAME with the ownership set to my user. I'm trying to use udevil/devmon for automounting. Here's what happens when I run udevil and udisksctl as my user (maciek):
$ udisksctl mount -b /dev/sda
Mounted /dev/sda at /media/KOBOeReader.
$ ls -lA /media/
drwxr-xr-x 12 maciek maciek 4096 Dec 31 1969 KOBOeReaderThis is working as intended (though it's weird that the date is set to Dec 31 1969).
Compare to udevil:
$ udevil mount /dev/sda
Mounted /dev/sda at /media/KOBOeReader
$ ls -lA /media/
drwxr-xr-x 12 root root 4096 Dec 31 1969 KOBOeReaderudevil has mounted my device as root, and my user can't write to it.
I have been trawling through config files, wiki entries, forum posts and can't find any way to fix this. Note that in both cases I'm running udevil as a user, not as root. Also, same behaviour happens if I enable:
systemctl start devmon@maciek.service.
How can I get my devices automounting without root ownership?
Edit: FS being mounted is vfat, so I don't actually care about the ownership/permissions. I just want my user to be able to write to the device.
Last edited by MaciekChudek (2017-07-23 01:58:34)
Offline
Did you try simply running devmon as your user?
Offline
Alas, as we say in the old country, "same shit, different bucket". It just calls udevil:
$ devmon --mount /dev/sda --mount-options nosuid,nodev,noatime
devmon: /usr/bin/udevil --mount /dev/sda --mount-options "nosuid,nodev,noatime" # (KOBOeReader)
Mounted /dev/sda at /media/KOBOeReader
$ ls -lA /media
drwxr-xr-x 12 root root 4096 Dec 31 1969 KOBOeReaderOffline
Not in client mode, but in automount mode.
Stupid question: why is there "Dec 31"? Your date being off or an old, unremovable directory being re-used as mount path?
Offline
I'm also wondering about the date...
System time is right:
$ date
Sat Jul 22 10:35:08 MDT 2017Date on parent directory is right:
$ ls -l /
...
drwxr-xr-x 3 root root 4096 Jul 22 10:34 media
.../media is empty when no device mounted
ls -l /media
total 0so the mount point subdirectories with the weird dates are being created by udevil.
As for running devmon as user in automount mode:
$ sudo systemctl stop devmon@maciek
$ devmon --mount-options nosuid,nodev,noatime-- DISK PLUGGED IN --
===========================================
Monitoring activity from the disks daemon. Press Ctrl+C to cancel.
===========================================
added: /org/freedesktop/UDisks/devices/sda
device: [/dev/sda]
systeminternal: [0]
usage: [filesystem]
type: [vfat]
label: [KOBOeReader]
ismounted: [0]
nopolicy: [0]
hasmedia: [1]
opticaldisc: []
numaudiotracks: []
blank: []
media: []
partition: [0]
devmon: /usr/bin/udevil --mount /dev/sda --mount-options "nosuid,nodev,noatime" # (KOBOeReader)
Mounted /dev/sda at /media/KOBOeReader
===========================================
changed: /org/freedesktop/UDisks/devices/sda
device: [/dev/sda]
systeminternal: [0]
usage: [filesystem]
type: [vfat]
label: [KOBOeReader]
ismounted: [1]
nopolicy: [0]
hasmedia: [1]
opticaldisc: []
numaudiotracks: []
blank: []
media: []
partition: [0]but still:
ls -l /media/
drwxr-xr-x 12 root root 4096 Dec 31 1969 KOBOeReaderI just noticed that in "/etc/udevil/udevil.conf" it says:
# Use the settings below to change the default locations of programs used by
# udevil, or (advanced topic) to redirect commands to your scripts.
# When substituting scripts, make sure they are root-owned and accept the
# options used by udevil (for example, the mount_program must accept --fake,
# -o, -v, and other options valid to mount.)
# Be sure to specify the full path and include NO OPTIONS or other arguments.
# These programs may also be specified as configure options when building
# udevil.
# THESE PROGRAMS ARE RUN AS ROOT
# mount_program = /bin/mount
# umount_program = /bin/umount
# losetup_program = /sbin/losetup
# setfacl_program = /usr/bin/setfaclSo it looks like it is running mount as root by design, but in that case how exactly is this meant to be a tool that lets non-root users automount removable media? What am I not grasping here?
Last edited by MaciekChudek (2017-07-22 16:51:29)
Offline
Mounting requires root permissions, udevil should be suid'd - this does not determine the permissions of the mounted device.
The default_options_vfat in /etc/udevil/udevil.conf should include uid= and gid=
pacman -Qkk udevilshould tell you whether you altered anything here. Also ensure it's not shadowed by /etc/udevil/udevil-user-`whoami`.conf
You might try hardcoding your actual IDs here (ask "id", use numbers, not names) to see whether the user is wrongly resolved as root (because of some sudo somewhere? "type udevil" being an alias or script?)
Offline
Thank you. Arch forums are the best.
Solution was to add "uid=$UID, gid=$GID " to "default_options_vfat".
This should have been obvious and I was just having a bad day and needed someone to talk me through it. Thanks for being that guy! Also, "pacman -Qkk" is super handy, even after years I keep learning new useful features of pacman.
Offline