Server tips

Posted on 2020-09-17 in Trucs et astuces

Start systemd services automatically for a user

By default sysemtd services linked to a user – created with systemctl --user enable --now service for instance – are only started after the first login of the user. To start them when the server starts, you must enable lingering for the user with (as root):

loginctl enable-linger USER

You can also soo the lingering status for a user with (as root):

loginctl show-user USER --property Linger

Source: https://wiki.archlinux.org/index.php/Systemd/User#Automatic_start-up_of_systemd_user_instances