We've enabled systemd --user on our servers, and now users can manipulate their services themselves.

When a user foo logs-in directly, things like systemctl --user status work as expected -- foo's own services are listed. So far so good.

However, when another user -- bar -- switches identity to foo using sudo (or ksu), the same command prints a D-BUS connection-failure error...

I suspect, some environment variable remains pointing at bar -- instead of foo -- even after the identity-change, but I cannot figure out, which one...

How do we work around this problem? Using RHEL7 here, if it matters...

  • 3
    Does this answer your question? unix.stackexchange.com/a/615964/272848 – Stewart Feb 5 at 19:01
  • Yes, it does, thank you!.. Now, why wouldn't sudo and ksu take care of that particular environment variable -- XDG_RUNTIME_DIR -- and how should one deal with it?.. Sigh... – Mikhail T. Feb 10 at 3:25

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.