May not access environment variables populated by pamd_systemd
For most Linux distributions usingsystemdas their init, the default
methods used bybecomedo not open a new “session”, in the sense ofsystemd. Because thepam_systemdmodule will not fully initialize a new
session, you might have surprises compared to a normal session opened through
ssh: some environment variables set bypam_systemd, most notablyXDG_RUNTIME_DIR, are not populated for the new user and instead inherited
or just emptied.
This might cause trouble when trying to invokesystemdcommands that depend onXDG_RUNTIME_DIRto access the bus:
To forcebecometo open a newsystemdsession that goes throughpam_systemd, you can usebecome_method:machinectl.
For more information, seethis systemd issue.