systemd version the issue has been seen with
250
Used distribution
No response
Linux kernel version used
5.19.15-lqx1.0.fc36.x86_64
CPU architectures issue was seen on
x86_64
Component
systemd
Expected behaviour you didn't see
Either permission denied errors or lack of content in the output for /home and /run/user
Unexpected behaviour you saw
ls shows content of /home and /run/user
Steps to reproduce the problem
ProtectHome option is described by manual as:
Takes a boolean argument[…]. If true, the directories /home/, /root, and /run/user are made inaccessible and empty for processes invoked by this unit.[…]
For testing purposes I needed to run some graphical app but deny it any possible access to my HOME dir (which may be used together with setting HOME to an arbitrary dir, but is orthogonal to that). So I created a service that makes use of ProtectHome=true which I expected to do exactly that. To my dismay, the option simply doesn't work.
Steps to reproduce In terms of terminal commands:
$ cat ~/.config/systemd/user/test.service
[Unit]
Description=Test unit
[Service]
Type=oneshot
ExecStart=/usr/bin/ls /home/ /run/user/
ProtectHome=true
[Install]
WantedBy=multi-user.target
$ systemctl --user daemon-reload
$ systemctl --user start test
$ systemctl --user status test
○ test.service - Test unit
Loaded: loaded (/home/konstantin/.config/systemd/user/test.service; disabled; vendor preset: disabled)
Active: inactive (dead)
окт 15 13:56:55 fedora systemd[3399]: Starting test.service - Test unit...
окт 15 13:56:55 fedora ls[21097]: /home/:
окт 15 13:56:55 fedora ls[21097]: konstantin
окт 15 13:56:55 fedora ls[21097]: /run/user/:
окт 15 13:56:55 fedora ls[21097]: 0
окт 15 13:56:55 fedora ls[21097]: 1000
окт 15 13:56:55 fedora systemd[3399]: Finished test.service - Test unit.
Additional program output to the terminal or log subsystem illustrating the issue
окт 15 13:56:55 fedora systemd[3399]: Starting test.service - Test unit...
окт 15 13:56:55 fedora ls[21097]: /home/:
окт 15 13:56:55 fedora ls[21097]: konstantin
окт 15 13:56:55 fedora ls[21097]: /run/user/:
окт 15 13:56:55 fedora ls[21097]: 0
окт 15 13:56:55 fedora ls[21097]: 1000
окт 15 13:56:55 fedora systemd[3399]: Finished test.service - Test unit.
systemd version the issue has been seen with
250
Used distribution
No response
Linux kernel version used
5.19.15-lqx1.0.fc36.x86_64
CPU architectures issue was seen on
x86_64
Component
systemd
Expected behaviour you didn't see
Either
permission deniederrors or lack of content in the output for/homeand/run/userUnexpected behaviour you saw
lsshows content of/homeand/run/userSteps to reproduce the problem
ProtectHomeoption is described by manual as:For testing purposes I needed to run some graphical app but deny it any possible access to my HOME dir (which may be used together with setting
HOMEto an arbitrary dir, but is orthogonal to that). So I created a service that makes use ofProtectHome=truewhich I expected to do exactly that. To my dismay, the option simply doesn't work.Steps to reproduce In terms of terminal commands:
Additional program output to the terminal or log subsystem illustrating the issue