How do I setup a systemd service to be started by a non root user as a user daemon?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2 Looping
--
Chapters
00:00 How Do I Setup A Systemd Service To Be Started By A Non Root User As A User Daemon?
02:00 Accepted Answer Score 24
02:44 Thank you
--
Full question
https://superuser.com/questions/476379/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#archlinux #user #rtorrent #systemd
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2 Looping
--
Chapters
00:00 How Do I Setup A Systemd Service To Be Started By A Non Root User As A User Daemon?
02:00 Accepted Answer Score 24
02:44 Thank you
--
Full question
https://superuser.com/questions/476379/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#archlinux #user #rtorrent #systemd
#avk47
ACCEPTED ANSWER
Score 24
systemd normally does not allow ordinary users to start system services. While it does support giving access via polkit, that part is still somewhat lacking, and you cannot yet allow only one specific service.
(Edit: Later systemd versions do support it, but only with polkit v106 or later.)
Since rtorrent is not actually a system service, and because you want every user to have their own instance of rtorrent, experiment with systemd's "user" mode.
When you log in, the system will start a user@<uid>.service
system unit for you, which will launch a separate "--user" instance of systemd. The new user-systemd will read unit files (starting with default.target
) from ~/.config/systemd/user/
, /etc/systemd/user/
and /usr/lib/systemd/user/
.