How do I setup a systemd service to be started by a non root user as a user daemon?

Posted by Hans on Super User See other posts from Super User or by Hans
Published on 2012-09-17T23:33:22Z Indexed on 2012/09/18 9:40 UTC
Read the original article Hit count: 356

Filed under:
|
|
|

I just finished the install and setup process of systemd on my arch-linux system (2012.09.07). I uninstalled initscripts (and removed the configuration files).

What I want to do is create a service that can be started and stopped by a non-root user. The service is to start a detached screen session running rtorrent. However I want every user on the system who has set this service to start (enabled) to have a particular instance started for them specifically. How would one go about doing this?

I remember reading that systemd supports user instances of services, however I have been unable to find any information on how to set this up, or whether it relates to what I am looking for.

Service file that I have used for system:

[Unit]
Description=rTorrent

[Service]
Type=forking
ExecStart=/usr/bin/screen -d -m -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent

© Super User or respective owner

Related posts about arch-linux

Related posts about user