I know how to enable/disable lingering with loginctl
.
But up to now I found no way to query the status of a user.
I want to know: Is lingering enable for user foo
?
How can I access this information?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityI know how to enable/disable lingering with loginctl
.
But up to now I found no way to query the status of a user.
I want to know: Is lingering enable for user foo
?
How can I access this information?
You can show a list of lingering users with
ls /var/lib/systemd/linger
because
loginctl enable-linger $USER
loginctl disable-linger $USER
do the equivalent of
touch /var/lib/systemd/linger/$USER
rm /var/lib/systemd/linger/$USER
/var/lib/systemd/linger
does not exist until you « linger » your first user
May 18, 2020 at 14:48
loginctl user-status foo
shows linger status.
The best I found for check it in scripts (programmatically):
loginctl show-user "$USER" --property=Linger | grep -q 'yes'