You are not logged in.

#1 2012-06-13 12:17:14

awagner
Member
From: Mainz, Germany
Registered: 2007-08-24
Posts: 191

[solved] Non-root program to create subdir in /run/lock

Hi all,

I am using and maintaining (more or less) the program logcheck. When the program is run (e.g. by a cronjob) and the directory /var/run/logcheck is not already present, it creates it. Since the recent update of the filesystem package, the lock directory is symlinked to /run/lock, which is in a temporary mountpoint, so that on every reboot, the directory needs to be re-created. The problem is that the program, running under its own "logcheck" account, does not possess sufficient rights to create a directory in /run/lock.

Any ideas how I should approach this - perhaps even short of rewriting the program in order not to use this subdirectory? (I think in the past, I have manually created the directory once and chowned it to "logcheck" so that the program was using it fine all the time.)

TIA,
Andreas

Last edited by awagner (2012-06-14 06:00:56)

Offline

#2 2012-06-13 12:35:06

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [solved] Non-root program to create subdir in /run/lock

Use tmpfiles.

/etc/tmpfiles.d/logcheck.conf wrote:
d /run/lock/logcheck 0755 logcheck logcheck -

man tmpfiles.d for more detail.

Last edited by falconindy (2012-06-13 12:35:27)

Offline

#3 2012-06-13 12:55:00

awagner
Member
From: Mainz, Germany
Registered: 2007-08-24
Posts: 191

Re: [solved] Non-root program to create subdir in /run/lock

falconindy wrote:

Use tmpfiles.

Cool. I wasn't aware of this. Just to be sure: This will work even with plain old arch initscripts instead of systemd?

Offline

#4 2012-06-13 15:55:25

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [solved] Non-root program to create subdir in /run/lock

Yep, this has been available to sysvinit users for quite some time via a shell reimplementation that I wrote. Since the introduction of systemd-tools, we've scrapped that and just call the systemd version instead.

Offline

#5 2012-06-13 17:39:19

awagner
Member
From: Mainz, Germany
Registered: 2007-08-24
Posts: 191

Re: [solved] Non-root program to create subdir in /run/lock

Great! Thanks for the advice (and for the tools of course). I will see to it that I include it in the next release of the logcheck package.

Offline

Board footer

Powered by FluxBB