Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

xdg open has ignored my directives. I have found several threads regarding how to open ssh://user@ip links (these are in our monitoring software). I have run the following commands:

gconftool-2 -s /desktop/gnome/url-handlers/ssh/command '/home/dankney/bin/SSH.handler %s' --type String
gconftool-2 -s /desktop/gnome/url-handlers/ssh/enabled --type Boolean true
gconftool-2 -s /desktop/gnome/url-handlers/ssh/needs_terminal --type Boolean true

Yet still when I attempt to use xdg-open (as the chrome browser does) it attempts to sftp instead...

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

It seems to be set correctly in the registery thingy

gconftool-2 -a /desktop/gnome/url-handlers/ssh
 command = /home/dankney/bin/SSH.handler %s
 needs_terminal = true
 enabled = true

Oh - here is the ls -alFh and contents of SSH.handler

ls -alFh /home/dankney/bin/SSH.handler 
-rwxrwxr-x 1 dankney dankney 133 Sep 18 21:16 /home/dankney/bin/SSH.handler*


cat /home/dankney/bin/SSH.handler*
#!/bin/bash
url=$1
protocol=${url//:*/}
machine=${url//*:\/\//}
machine=${machine%/}
/usr/bin/gnome-terminal -e "$protocol $machine"

what gives?

Oh - btw - the shell script indeed does work if run from command line...

share|improve this question
add comment

1 Answer 1

First you should set up a protocol handler, like this:

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

Then make a desktop entry file and put it somewhere like /usr/share/applications (perhaps it would be better to put it somewhere in ~/.config, though not sure where).

ssh.desktop:

[Desktop Entry]
Terminal=false
Type=Application
Exec=/home/dankney/bin/SSH.handler %F

Then next time xdg-open is called, it will use the ssh.desktop handler, which in turn will delegate the call to your shell script.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.