View previous topic :: View next topic |
Author |
Message |
Fraggle Apprentice
Joined: 13 Mar 2003 Posts: 187 Location: Washington, DC
|
Posted: Mon Jun 12, 2006 7:36 pm Post subject: SSH url handler |
|
|
I want to be able to click on ssh:// links from my browser or anywhere else within the windows environment. I searched the heck out of the forums and google for an answer and couldn't find one.
I want to be able to click the link and have it launch ssh.
Thanks in advance for the help! |
|
Back to top |
|
|
aries Tux's lil' helper
Joined: 03 May 2004 Posts: 127 Location: Sliedrecht the Netherlands
|
Posted: Mon Jun 12, 2006 8:24 pm Post subject: |
|
|
In kde (konqueror) just do:
|
|
Back to top |
|
|
Fraggle Apprentice
Joined: 13 Mar 2003 Posts: 187 Location: Washington, DC
|
Posted: Mon Jun 12, 2006 8:27 pm Post subject: |
|
|
aries wrote: | In kde (konqueror) just do:
|
How about gnome?
The problem is that the web page that is auto created gives me ssh:// links. I can't change them. So I need to associate ssh:// with ssh. |
|
Back to top |
|
|
sybille Tux's lil' helper
Joined: 15 Apr 2005 Posts: 111 Location: France
|
Posted: Tue Jun 13, 2006 1:59 am Post subject: |
|
|
Fraggle wrote: |
How about gnome?
The problem is that the web page that is auto created gives me ssh:// links. I can't change them. So I need to associate ssh:// with ssh. |
Which browser? Firefox? |
|
Back to top |
|
|
Fraggle Apprentice
Joined: 13 Mar 2003 Posts: 187 Location: Washington, DC
|
Posted: Tue Jun 13, 2006 12:15 pm Post subject: |
|
|
sybille wrote: | Fraggle wrote: |
How about gnome?
The problem is that the web page that is auto created gives me ssh:// links. I can't change them. So I need to associate ssh:// with ssh. |
Which browser? Firefox? |
Yes |
|
Back to top |
|
|
sybille Tux's lil' helper
Joined: 15 Apr 2005 Posts: 111 Location: France
|
Posted: Tue Jun 13, 2006 1:12 pm Post subject: |
|
|
You can set Firefox to use external programs to handle different protocols, including ssh.
You'd need to add a couple of entries to about:config (or user.js):
Code: |
network.protocol-handler.external.ssh
|
Make that a boolean entry, and set it to "true."
Code: |
network.protocol-handler.app.ssh
|
Make that a string entry and set it to whatever application you want to use for ssh. I think you could use nautilus, for example.
If you want a terminal to open up to the ssh address given in the browser link, then I think you'd need to write a simple script, something along the lines of
Code: |
#!/bin/sh
aterm -e ssh "$@"
|
My script-fu is pretty minimal, so there are probably better ways to do that. But I'd start with something along those lines. The "$@" is a placeholder for whatever address the ssh:// link is going to send to the terminal.
So once you know what command you'd like to run when the ssh:// link is clicked, all you need to do is tell Firefox to use that command.
More information on registering protocols in Firefox:
http://gentoo-wiki.com/TIP_Firefox_Settings#Registering_additional_protocols
http://kb.mozillazine.org/Register_protocol#Linux
http://kb.mozillazine.org/User.js_file[/code] |
|
Back to top |
|
|
Fraggle Apprentice
Joined: 13 Mar 2003 Posts: 187 Location: Washington, DC
|
Posted: Tue Jun 13, 2006 1:53 pm Post subject: |
|
|
Awesome! Thanks! |
|
Back to top |
|
|
Fraggle Apprentice
Joined: 13 Mar 2003 Posts: 187 Location: Washington, DC
|
Posted: Tue Jun 13, 2006 2:30 pm Post subject: |
|
|
Seems to pop up my window but it dies immediatly. My guess is that $@ isn't the correct variable to send.....When I do it from the command line "aterm -e ssh localhost" it works great.
It also works if I put in "aterm -e ssh localhost"
So it has to be the $@ |
|
Back to top |
|
|
sybille Tux's lil' helper
Joined: 15 Apr 2005 Posts: 111 Location: France
|
Posted: Tue Jun 13, 2006 2:56 pm Post subject: |
|
|
So you're an aterm user, too.
(I'm actually thinking of switching to rxvt-unicode, but that's another topic...)
Did you include the quotation marks with the variable, that is, "$@", not $@ ? |
|
Back to top |
|
|
Fraggle Apprentice
Joined: 13 Mar 2003 Posts: 187 Location: Washington, DC
|
Posted: Tue Jun 13, 2006 3:07 pm Post subject: |
|
|
sybille wrote: | So you're an aterm user, too.
(I'm actually thinking of switching to rxvt-unicode, but that's another topic...)
Did you include the quotation marks with the variable, that is, "$@", not $@ ? |
I have tried them both.
I have also tried it with both aterm and gnome-terminal with the exact same issues. (both work as long as I give them a hardcoded ip) |
|
Back to top |
|
|
sybille Tux's lil' helper
Joined: 15 Apr 2005 Posts: 111 Location: France
|
Posted: Tue Jun 13, 2006 3:35 pm Post subject: |
|
|
I know that variable works for other things, i.e. files and the ip address of ftp sites passed from firefox to gftp-text, but I'm just not enough of an ssh person to know what you need to use here.
Well, hopefully someone will come along and teach us both something. Or maybe there's something useful on Google.
You might try searching the forums at mozillazine, too.
http://forums.mozillazine.org/
Last edited by sybille on Tue Jun 13, 2006 3:45 pm; edited 1 time in total |
|
Back to top |
|
|
Fraggle Apprentice
Joined: 13 Mar 2003 Posts: 187 Location: Washington, DC
|
Posted: Tue Jun 13, 2006 3:40 pm Post subject: |
|
|
sybille wrote: | I know that variable works for other things, i.e. files and the ip address of ftp sites passed from firefox to gftp-text, but I'm just not enough of an ssh person to know what you need to use here.
Well, hopefully someone will come along and teach us both something. Or maybe there's something useful on Google. |
I've been raping google for information No luck yet. |
|
Back to top |
|
|
Fraggle Apprentice
Joined: 13 Mar 2003 Posts: 187 Location: Washington, DC
|
Posted: Tue Jun 13, 2006 5:22 pm Post subject: |
|
|
Code: |
# ssh ssh2://localhost
ssh: ssh2://localhost: Name or service not known
|
How much do you want to make a bet that is the problem? |
|
Back to top |
|
|
think4urs11 Bodhisattva
Joined: 25 Jun 2003 Posts: 6659 Location: above the cloud
|
Posted: Tue Jun 13, 2006 6:40 pm Post subject: |
|
|
Fraggle wrote: | Seems to pop up my window but it dies immediatly. My guess is that $@ isn't the correct variable to send.....When I do it from the command line "aterm -e ssh localhost" it works great.
It also works if I put in "aterm -e ssh localhost"
So it has to be the $@ |
Not exactly as $@ gives the whole link like ssh://user@somewhere.org which obviously ssh doesn't know how to handle.
Use a little wrapper script to start ssh and everything works; all whats needed is to cut off the 'header' (ssh:// that is)
so for sake of completeness you need to do
- in Firefox (either via about:config OR via user.js)
a) create a new entry, type boolean named network.protocol-handler.external.ssh with value true
b) create a new entry, type string named network.protocol-handler.app.ssh with value (e.g.) /usr/local/bin/ssh-handler-wrapper
- on unix commandline
create a wrapper script which rebuilds the server address in a way openssh can handle (remove ssh://)
a) nano /usr/local/bin/ssh-handler-wrapper
/usr/local/bin/ssh-handler-wrapper: | #!/bin/sh
xterm -e ssh `echo $@ | sed 's/ssh:\/\///'` |
b) chmod +x /usr/local/bin/ssh-handler-wrapper
plus of course having a web site with SSH-Links like
/www/my_ssh-links.html: | <html>
<head></head><body>
<a href="ssh://domain2.org">a Server with user 'same as the one started firefox</a>
<a href="ssh://user@domain.org">one Server with user 'user'</a>
<a href="ssh://domain2.org">a Server with user 'same as the one started firefox</a>
<a href="ssh://joe@1.2.3.4">a Server with unknown fqdn, username 'joe'</a></body></html> |
HTH _________________ Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself |
|
Back to top |
|
|
Fraggle Apprentice
Joined: 13 Mar 2003 Posts: 187 Location: Washington, DC
|
Posted: Tue Jun 13, 2006 7:45 pm Post subject: |
|
|
That worked exactly as I needed. I was surprisingly actually on the right track!
Thanks! |
|
Back to top |
|
|
sybille Tux's lil' helper
Joined: 15 Apr 2005 Posts: 111 Location: France
|
Posted: Tue Jun 13, 2006 8:07 pm Post subject: |
|
|
Think4UrS11 wrote: | ... $@ gives the whole link like ssh://user@somewhere.org which obviously ssh doesn't know how to handle.
<snip>
/usr/local/bin/ssh-handler-wrapper: | #!/bin/sh
xterm -e ssh `echo $@ | sed 's/ssh:\/\///'` |
|
Thanks. |
|
Back to top |
|
|
think4urs11 Bodhisattva
Joined: 25 Jun 2003 Posts: 6659 Location: above the cloud
|
Posted: Tue Jun 13, 2006 11:26 pm Post subject: |
|
|
Fraggle wrote: | That worked exactly as I needed. Thanks! |
glad to be helpful _________________ Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself |
|
Back to top |
|
|
|