User Tools

Site Tools


linux:system:linger

Linger

By default, users cannot set user services to run at boot time. The admin must enable this on an individual basis for each user. If lingering is enabled for a specific user, a user manager is spawned for the user at boot and kept around after logouts. This allows users who are not logged in to run long-running services. Takes one or more user names or numeric UIDs as argument. If no argument is specified, enables/disables lingering for the user of the session of the caller.

Enable Lingering for user

loginctl enable-linger $USER
loginctl disable-linger $USER

Or alternatively:

touch /var/lib/systemd/linger/$USER
rm /var/lib/systemd/linger/$USER

Show status for user

You can show a list of lingering users with:

ls /var/lib/systemd/linger

Or alternatively:

 loginctl user-status $USER

Check status in scripts

To check user lingering status in scripts (programmatically):

loginctl show-user "$USER" --property=Linger | grep -q 'yes'
linux/system/linger.txt · Last modified: by 127.0.0.1