05.01.2026 21:06, Thomas Schneider wrote:
Hello,
I want to setup on-demand mount of a remote directory using rclone in my
home directory.
This means, directory ~/mnt/nextcloud must only be mounted if the user
triggers access to it.

For this I created two files:
❯ cat .config/systemd/user/home-thomas-mnt-nextcloud.mount
[Unit]
Description=Rclone for Nextcloud Mount
After=network-online.target
Wants=network-online.target

[Mount]
Type=rclone
What=nextcloud:
Where=/home/thomas/mnt/nextcloud
Options=rw,_netdev,allow_other,vfs-cache-mode=full,vfs-cache-max-size=4G,vfs-cache-max-age=24h,config=/home/thomas/.config/rclone/rclone.conf,cache_dir=/home/thomas/.rclone/cache
❯ cat .config/systemd/user/home-thomas-mnt-nextcloud.automount
[Unit]
Description=Rclone for Nextcloud Automount

[Automount]
Where=/home/thomas/mnt/nextcloud
TimeoutIdleSec=600

[Install]
WantedBy=default.target

I can start mount-unit home-thomas-mnt-nextcloud.mount w/o problems:
❯ systemctl --user start home-thomas-mnt-nextcloud.mount
❯ findmnt /home/thomas/mnt/nextcloud
TARGET                     SOURCE     FSTYPE      OPTIONS
/home/thomas/mnt/nextcloud nextcloud: fuse.rclone
rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,allow_other

But any attempt to start automount-unit
home-thomas-mnt-nextcloud.automount fails with error:

automount requires root privileges and cannot be done in user context. I am surprised systemd allowed "true" mount units in the user instance (I was sure they only work system wide)


Reply via email to