Currently, bind-mounted directories within a user/mount namespace get the uid/gid stored on their files. If the host creates a file in the source directory, it will still show as root in the namespace. Id-mapping is a filesystem feature that allows a mount namespace to show a different uid than what is actually stored on a file. Add support for id-mappings to exec directories, so that the files within the mount namespace are owned by the unprivileged uid/gid. Example: Using unit: ``` [Unit] Description=Sample service [Service] MountAPIVFS=yes DynamicUser=yes PrivateUsers=yes TemporaryFileSystem=/run /var/opt /var/lib /vol UMask=0000 ExecStart=/bin/bash -c 'while true; do echo "ping"; sleep 5; done' StateDirectory=andresstatedir:sampleservice [Install] WantedBy=multi-user.target ``` In the host namespace, creating a file "test": ``` root@abeltran-test:/var/lib/andresstatedir# ls -lah total 8.0K drwxr-xr-x 2 root root 4.0K Aug 21 23:48 . drwx------ 3 root root 4.0K Aug 21 23:47 .. -rw-r--r-- 1 root root 0 Aug 21 23:48 test ``` Within the unit namespace: ``` root@abeltran-test:/var/lib/sampleservice# ls -lah total 4.0K drwxr-xr-x 2 63750 63750 4.0K Aug 21 23:48 . drwxr-xr-x 3 root root 60 Aug 21 23:47 .. -rw-r--r-- 1 63750 63750 0 Aug 21 23:48 test ``` ``` root@abeltran-test:/# mount | grep and /dev/sda1 on /var/lib/private/andresstatedir type ext4 (rw,nosuid,noexec,relatime,idmapped,discard,errors=remount-ro,commit=30) ```
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
