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...
sudoandksutake care of that particular environment variable --XDG_RUNTIME_DIR-- and how should one deal with it?.. Sigh... – Mikhail T. Feb 10 '21 at 03:25