I'm trying to set up some tasks and services on my machine across different users.
One task is to run regular backups using restic with a regular user restic. While I can skip file permission checks for the restic binary via setcap cap_dac_read_search=+ep ~restic/bin/restic, I have trouble with another aspect of this:
Some services can only be reliably backed up while they are stopped. These services are managed by another user's systemd, however.
As root I can systemctl --user --machine [email protected] stop myservice.service just fine, but as user restic I get:
Failed to connect to system scope bus via machine transport: Permission denied
Failed to list units: Transport endpoint is not connected
(I even get the same error when I attempt to use the --machine option with my current username.)
I have tried to grant extended capabilities to a copy of the systemctl binary, but I suppose either I haven't found the correct ones, or other binaries might be involved, or what I am trying to do is not possible.
Any advice would be appreciated.
sudocall tosystemctl.