You are not logged in.
Hi,
I plan to use bittorrent-sync, and want to run it for each user separately. So I would like to modify the service to run the process as the user instead of root. Like bittorrent-sync@user1… and so on.
Is this possible?
Thanks
Last edited by silentsnake (2013-04-27 15:13:25)
Offline
Two ways:
One, under [Service] include a line "User=<username to run as>".
Two, use a systemd --user session.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks
Offline
If you want to take the time to set it up, systemd --user is pretty awesome. I use it to handle just about everything for my user, including X and the i3wm. I don't use a DM, so it just takes me straight to the GUI.
To add to what Trilby is telling you above. To make per user system services, instead of simply adding a User=silentsnake, you could instead use "User=%I" and then rename the service as bt-sync@.service. That way you can enable bt-sync@silentsnake.service as well as bt-sync@wonderwoofy.service and bt-sync@Trilby.service.
Offline
Thanks to you too, WonderWoofy.
[Unit]
Description=BitTorrent Sync service
After=network.target
[Service]
ExecStart=/usr/bin/btsync --nodaemon --config /home/%i/.sync/btsync.conf
Restart=on-abort
User=%i
Group=users
[Install]
WantedBy=multi-user.target
This allows me to run one instance per user with its own configuration. Since it's a server with no users actively working on, I think this is the way to go. But will investigate the systemd user session for my desktop clients.
Offline
See, the only problem with the bt-sync@.service (system service) is that only root is able to start/stop/enable/etc. these services. By setting up systemd user services, you can mae it so that each user has the ability to turn this syncing on or off as desired.
Offline
Thats a good point indeed.
Offline
You also don't have to use systemd --user for all your stuffs like I do. You can choose to use it for as much or as little as you would like. There is a wiki page covering what you need to do to get this working. Also gtmanfred has a great blog post (I think it is the only post on his blog actually) from which that wiki page is referenced. Reading through it will give you an idea of what you need to set up to get it going. Though you do not have to include the stuff about getting your window manager running though it.
Offline