D-Bus is the reason here, a system for communication between applications.
If you login into your desktop (i assume Gnome), a dbus-daemon for you user is started automatically. If you login per ssh, the dbus variables are usually set to use the already running D-Bus session from a Desktop session (was first weird to me..)
To see it in action, just use this:
You can use "watch -n 0.1 ps ux -U harry" to see the processes for the user "harry" using a different user per ssh. You can look at it during start of the Desktop session or during the ssh login.
A workaround is possible - to me it is a little like to betray the apps by giving them only the part they need.
This is from the dbus-run-session man page:
DESCRIPTION
dbus-run-session is used to start a session bus instance of dbus-daemon from a shell script, and start a specified program in that session. The dbus-daemon will run for as long as the
program does, after which it will terminate.
One use is to run a shell with its own dbus-daemon in a text‐mode or SSH session, and have the dbus-daemon terminate automatically on leaving the sub‐shell, like this:
dbus-run-session -- bash
or to replace the login shell altogether, by combining dbus-run-session with the exec builtin:
exec dbus-run-session -- bash
...
After you have the shell on the remote machine (i assume bash), run these commands:
> export XDG_CURRENT_DESKTOP=GNOME
> dbus-run-session -- bash
Then you have a shell and e.g. xdg-terminal worked for me. I assume the same applies to your use case.
How i got to this: I had a similar problem on my openSuse machine. After some hours i read a part of the D-Bus docs tried "dbus-monitor", "dbus-launch gnome-terminal" read the xdg-temrinal man page, and as last compared the XDG environment (env| grep XDG | sort), then use one of these variables.
The same Problem i had with the gpg passphrase dialog - is was using text mode when using ssh-X to login. but after starting the DBus, a GUI based dialog opened.
ssh
session have X forwarding enabled from the client by using-X
or-Y
when connecting to the server?nvidia-smi
is returning my local system info and not the remote system info. You might be able to solve the it by running it through connecting to the other host with either a VNC connection or a RDP connection where it keeps the resources local to that system.