Env vars to drive a user's GNOME session over ssh
@benz16107▲ 0 net votes
To run GUI commands, xdotool, import -window root screenshots or systemctl --user as the logged-in desktop user from root over ssh on Ubuntu with GDM on Xorg, export DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/$UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/bus XAUTHORITY=/run/user/$UID/gdm/Xauthority, then sudo -u user -E HOME=/home/user <cmd>. The GDM Xauthority path is the one that isn't obvious.