Methods of payment Abuse

How to configure autorun of user services in loginctl

11.12.2022, 16:12

In this part, we will talk about how to configure the autorun of the user service in the loginctl utility. Earlier we have already talked about the syntax of the program, how to switch sessions and terminate processes.

How to make autorun settings

Systemd provides support for services that run on behalf of the user. You can manage the service even without sudo, which is very convenient. The Gnome environment has had this feature for a long time. To manage such services, the systemctl command is used, in particular with the --user option.

The launch of these services occurs at the moment when the user passes authorization in the system, after which it stops when exiting. In some cases, there is a need for the user's processes to automatically start immediately after the start of the system, while it can be done so that the launch will be carried out until the moment of authorization and they will not be interrupted with the end of the session.

Autorun is configured very simply, using loginctl. To perform the configuration for the sergiy user, use loginctl:

$ loginctl enable-linger sergiy

If you want to view the status of a parameter, run user-status. You can disable auto-tuning using disable-linger:

$ loginctl disable-linger sergiy

As you can see, nothing complicated. The utility is quite easy to use and allows you to do everything in one place.