How to override the Gnome 3 SSH handler?

I would like to be able to click on SSH links that look like ssh://user@servername and have a gnome-terminal open that runs SSH inside of it.

After reading up on the XDG stuff I did the following:

I created a shell script in $HOME/bin/ssh-terminal with the following:

gnome-terminal -e "ssh $dest" &

This works from the command line.

I created $HOME/.local/share/applications/ssh-terminal.desktop with:

[Desktop Entry]
Name=SSH Terminal
Exec=ssh-terminal %u

I ran update-desktop-database ~/.local/share/applications/

Now when I try to run xdg-open ssh://user@hostname I get the following error:

$ xdg-open ssh://buildbot@
gvfs-open: sftp://buildbot@ error opening location: The specified location is not mounted

I don’t want to open it as a sftp mount and I cannot seem to find where that is set!

Where do I go from here?

Asked By: Zan Lynx


Writing a .desktop file is not enough. You also need to change the default setting for the mime type.

You can get the current default value with

 xdg-mime query default x-scheme-handler/ssh

and can change it with

 xdg-mime default ssh-terminal.desktop x-scheme-handler/ssh

The corresponding configuration file could be $HOME/.config/mimeapps.list or $HOME/.local/share/applications/mimeapps.list depending on your OS version.

Answered By: jofel

None of this worked for me until I edited the following file and removed the SchemeAlias line on /usr/share/gvfs/mounts/sftp.mount

# SchemeAliases=ssh
Answered By: user3559338
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.