<div class="gmail_quote"><div dir="ltr">On Sat, Feb 17, 2018, 20:42 Mirosław Zalewski <<a href="mailto:miniopl@poczta.onet.pl">miniopl@poczta.onet.pl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
I have a service that should run under user systemd instance. It needs<br>
access to directory outside of it's usual paths and does not follow<br>
symlinks, so I figured that `mount --bind` might be a way to go.<br>
<br>
However, I can't make BindPaths= directive work in user service file.<br>
It seems that directive is simply ignored. I can reproduce the issue<br>
using systemd-run:<br>
<br>
$ systemd-run -qt -p BindReadOnlyPaths=/run/user/1000/:/tmp/bindmount/ /bin/ls -a /tmp/bindmount/<br>
.   bus     dconf  gvfs         klauncherJ21213.1.slave-socket  ksocket-user    pulse      systemd<br>
..  dbus-1  gnupg  kdeinit5__0  KSMserver__0                    kwallet5.socket  rsnapshot<br>
<br>
$ systemd-run -qt --user -p BindReadOnlyPaths=/run/user/1000/:/tmp/bindmount/ /bin/ls -a /tmp/bindmount/<br>
.  ..<br>
<br>
<br>
Is this by design? I don't see any mention of this limitation in man<br>
entries for systemd.mount and for systemd.exec.<br></blockquote></div><div><br></div><div>It's not a systemd limitation. Mounting is a privileged operation in Linux and only available to root (or processes with the correct capabilities). Your systemd instance only has the same privileges you yourself have.</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><p dir="ltr">Mantas Mikulėnas <<a href="mailto:grawity@gmail.com">grawity@gmail.com</a>><br>
Sent from my phone</p>
</div></div>