Skip to content

systemd does not change the user and group ownership of RuntimeDirectory when root is not explicitly assigned to User #6391

@evverx

Description

@evverx

How to reproduce:

cat <<'EOF' >/etc/systemd/system/a.service
[Service]
RuntimeDirectory=rd
RuntimeDirectoryPreserve=yes
ExecStart=/bin/sh -x -c 'id; ls -l /run'
User=systemd-coredump
EOF

systemctl daemon-reload

systemctl start a

ls -l  d /run/rd
# drwxr-xr-x 2 systemd-coredump systemd-coredump 40 Jul 17 20:49 /run/rd

sed -i 's/^\(User\)/#\1/' /etc/systemd/system/a.service

systemctl daemon-reload

systemctl start a

ls -ld /run/rd
# drwxr-xr-x 2 systemd-coredump systemd-coredump 40 Jul 17 20:49 /run/rd
# should be
# drwxr-xr-x 2 root root 40 Jul 17 20:49 /run/rd

Using User=root explicitly works well

echo 'User=root' >>/etc/systemd/system/a.service

systemctl daemon-reload

systemctl start a

ls -ld /run/rd
# drwxr-xr-x 2 root root 40 Jul 17 20:49 /run/rd

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Programming errors, that need preferential fixingpid1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions