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

Post History

50%
+0 −0
Q&A Disable ability of users to enable lingering in systemd

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=un...

posted 3mo ago by GeraldS‭

Answer
#1: Initial revision by user avatar GeraldS‭ · 2024-10-30T10:57:30Z (3 months ago)
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_

```ini
[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_

```ini
[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.

```console
gerald@node:~$ loginctl enable-linger gerald
Could not enable linger: Access denied
```