Skip to main content
Improved the title to refelct the question somewhat better
Link

systemd What is the difference between systemd's user and system services?

Source Link
euri10
  • 441
  • 1
  • 6
  • 12

systemd user and system

I'm trying to understand a little better systemd by writing some services.

I have difficulties in understanding the differences between those 2 services for instance, well I'd like to be sure I understand them correctly would be more appropriate.

So for instance I got rtorrent service, defined as rt as a system service, that I can enable for user X,Y,Z, with sudo systemctl enable [email protected]

➜  ~  cat /etc/systemd/system/[email protected]
[Unit]
Description=rTorrent
Requires=network.target local-fs.target

[Service]
Type=forking
KillMode=none
User=%I
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
ExecStop=/usr/bin/tmux send-keys -t rt:rtorrent C-q
WorkingDirectory=/home/%I/
Restart=on-failure

[Install]
WantedBy=multi-user.target

and I got dropbox defined that way :

➜  ~  cat /etc/systemd/user/[email protected]
[Service]
ExecStart=/bin/sh %h/.dropbox-dist/dropboxd
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

If I understand well, the dropbox service can be started / stopped / enabled / disabled at a user level, for many users, even if that user isn't an admin. Does it mean I can as userX enable it for userY ? As for the rt service, only an admin can enable / start / stop it ... Is that the only difference between a system service and a user one ?