You are not logged in.
Hi,
I'm new to building Archlinux AUR packages and have the following problem.
I create a user in package() using systemd-sysuser and then I would like to give a directory, created while the installation, the file permissions of this user.
But a
chown -R user:user /directory
does not work because the user is not yet created?
How can I do something like this?
Many thanks in advance!
Greetings
Klaus.
Last edited by tachtler (2023-05-21 07:52:39)
Offline
With systemd you'd install a tmpfiles fragment to have systemd create this directory with appropriate permissions, especially if you already use a sysusers fragment to create the user.
More traditionally, you could add an install script to your package to create the user and adapt the permissions of the directory.
Offline
Hi lunaryorn,
thank you for your answer. I did it the way you suggested!
Thank you!
Klaus.
Offline
Note there is no need in the case of https://aur.archlinux.org/packages/graylog to change the ownership of /etc/graylog as the service file contains ConfigurationDirectory=graylog so starting the service will fix the ownership and before that the files will be owned root:root.
The tmpfiles snippet is also rendered redundant by the service file. You should not delete users on package removal, they can still own files. Also removing /run/graylog is not required as the directory will be removed when the service is stopped.
Offline