0

I'm trying to start/stop/determine the status of a user systemd service file from within a program, not running as root, using the systemd sd-bus api.

Lets stay with the example of determining the status. I test that stuff on the command line.

I made progress when preparing the environment with

export XDG_RUNTIME_DIR=/run/user/$(id -u)

and

export $(dbus-launch)

which i found in different sources when searching for that stuff on the web. When calling with that certain user

busctl --user --verbose get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/myservice org.freedesktop.systemd1.Unit ActiveState

the result turns to be

Process org.freedesktop.systemd1 exited with status 1

where before it was something like "Permission denied"

While running the stuff as root, without the user flag, gives me the desired stuff.

Anyone has hint what I might be missing else?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.