External devices now mount under /run/media/${USER}/{volID}
Since upgrading one of my systems to Ubuntu 26.04 I now find that when I plug in any USB device it no longer mounts the device under /media/{volID} but now mounts them under /run/media/${USER}/{volID} mountpoint.
From what I understand, udisks2 mounts partitions/disks to /run/media/$USER by default. This change is a security enhancement to keep mount points private and secure for each logged-in user. Basically mounting under /run/media/$USER ensures other users on the same machine cannot see or read your private USB files.
However, for me I heavely write scripts with hard codings which make me rely on devices being mounted under the old /media regime.
Yes, I know I could simply update my many scripts/projects and adjust configuration files to point to the new mountpoint (this is a task for another day) but for now I would like a solution to use the old method.
After a little research and testing various configurations, I come up with the following that works for me.
- As root (or super-user) create a new udev rules file:
root@ubunutu26# vi /etc/udev/rules.d/99-media-mount-point.rules
- Add the following line to your new file:
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1" - Get systemd-udevd to reload the rules files:
root@ubuntu26# udevadm control --reload
NOTE: Reloading the udev rules does not apply changes to any already mounted external devices. The new configuration will only be applied to new events.
Be the first to comment.
Leave a response