I have performed file association for my custom extension(.vwxy), I have created the mime specification file and the desktop entry file for that.

I m able to launch my application via xdg-open <myfile.ext> on the terminal in ubuntu 20.04, but doing the same via ssh terminal session does not launch my application.

But my extension is registered for the mime, and the mime is registered for the application as can be seen by the result of the following commands in the ssh terminal.

gio info myFile.vwxy | grep "standard::content-type"

output : standard::content-type: application/myMimeType

 gio mime application/myMimeType


Registered applications:
Recommended applications:

Is there anything that I m missing?

  • Does your ssh session have X forwarding enabled from the client by using -X or -Y when connecting to the server?
    – Terrance
    Jun 28 at 1:15
  • @Terrance No, It does not have it enabled. But how will it anyways impact the working of xdg-open? Jun 28 at 3:54
  • xdg-open will open either an html link or a file. Either way, it is trying to launch a graphical application. X forwarding will send the data to the computer you are using generating the graphical application on your screen instead of the server.
    – Terrance
    Jun 28 at 4:10
  • Mine is not even a GUI application, it is a console application without any GUI component. Any idea why is it happening in that case? Jun 28 at 4:15
  • One thing I have noticed is that whenever you try to run any application it tries to launch it on the local system and not the remote system through ssh. You might want to see: askubuntu.com/questions/1465485/… where I show how a non-graphical application like 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.
    – Terrance
    Jun 28 at 4:24

1 Answer 1


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:

       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:

 > 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .