Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Disable ability of users to enable lingering in systemd

+1
−0

Can I disable the ability of regular users to enable lingering in loginctl?

By default every user on a systemd enabled Linux can run loginctl --enable-linger and have a personal systemd instance started that starts services in userspace after reboots. I have the need to disable this capability.

man logind.conf does not show anything helpful. Every search term I can think of only leads to instructions on how to use it.

In a couple of places it has been suggested to clean the folder /var/lib/systemd/linger/ on shutdown, so they are gone when the system starts up next time. But that seems rather hacky. Is there any regular option to disable lingering?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+0
−0

I managed to disable the feature via polkit. To do this I created two policy files:

/etc/polkit-1/localauthority/50-local.d/50-disable-linger-self.pkla

[disable loginctl linger self]
Identity=unix-user:*
Action=org.freedesktop.login1.set-self-linger
ResultAny=no
ResultInactive=no
ResultActive=no

/etc/polkit-1/localauthority/50-local.d/60-disable-linger-user.pkla

[disable loginctl linger user]
Identity=unix-user:*
Action=org.freedesktop.login1.set-user-linger
ResultAny=no
ResultInactive=no
ResultActive=no

This effectively disables the ability for regular users.

gerald@node:~$ loginctl enable-linger gerald
Could not enable linger: Access denied
History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »