You are not logged in.

#1 2022-01-19 09:28:36

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 1,992
Website

[SOLVED] systemd-sysusers: permissions of $HOME

I manage a package, that requires a special user for a daemon.
To create this user on package installation, I use systemd-sysusers with the following configuration.

# HOMEINFO digital signage user.
u	digsig	-	"HOMEINFO Digital Signage User"	/var/lib/digsig

# HOMEINFO digital signage group.
g	digsig	-	-

# HOMEINFO digital signage group memberships.
m	digsig	digsig
m	digsig	audio

However, this will create the $HOME directory /var/lib/digsig with mode 750.
I, however, want it to have mode 755.
I read the man page to no avail.
Is it possible to achieve this with systemd-sysusers or do I need to run chmod manually in post_install() or an ALPM hook?

Solved
I solved my x/y problem another way.
Instead of allowing all users to read that directory I added the necessary users to the group.

# HOMEINFO digital signage user.
u	digsig	-	"HOMEINFO Digital Signage User"	/var/lib/digsig

# HOMEINFO digital signage group.
g	digsig	-	-

# HOMEINFO digital signage group memberships.
m	digsig	digsig
m	digsig	audio
m	http    digsig
m   homeinfo    digsig

Last edited by schard (2022-01-19 10:10:52)


macro_rules! yolo { { $($tokens:tt)* } => { unsafe { $($tokens)* } }; }

Offline

#2 2022-01-19 11:06:12

0b100100
Member
Registered: 2021-09-04
Posts: 9

Re: [SOLVED] systemd-sysusers: permissions of $HOME

For future readers who find this thread and want to accomplish the initial question.

A home directory with mode 0755 could be accomplished with the help of:

- tmpfiles.d (/usr/lib/tmpfiles.d/$pkgname.conf):

d /var/lib/digsig 0755 digsig digsig -

- systemd.exec (/usr/lib/systemd/system/$pkgname.service):

StateDirectory=digsig

The first method will create the directory during the installation of the package and the second will create it at the first service start.
Beware: The second method will only default to 0755 if it isn't changed with StateDirectoryMode=xxxx.

Offline

Board footer

Powered by FluxBB