I have a service that should run under user systemd instance. It needs
access to directory outside of it's usual paths and does not follow
symlinks, so I figured that `mount --bind` might be a way to go.

However, I can't make BindPaths= directive work in user service file.
It seems that directive is simply ignored. I can reproduce the issue
using systemd-run:

$ systemd-run -qt -p BindReadOnlyPaths=/run/user/1000/:/tmp/bindmount/ /bin/ls 
-a /tmp/bindmount/
.   bus     dconf  gvfs         klauncherJ21213.1.slave-socket  ksocket-user    
pulse      systemd
..  dbus-1  gnupg  kdeinit5__0  KSMserver__0                    kwallet5.socket 

$ systemd-run -qt --user -p BindReadOnlyPaths=/run/user/1000/:/tmp/bindmount/ 
/bin/ls -a /tmp/bindmount/
.  ..

Is this by design? I don't see any mention of this limitation in man
entries for systemd.mount and for systemd.exec.

If using BindPaths in user service file is not an option, can I somehow
make system service run automatically when this user service is

Thanks in advance,
Mirosław Zalewski
systemd-devel mailing list

Reply via email to