Saturday, September 1, 2007

SSH handler for Firefox

linux


add the following lines to user.js (in the profile folder):

user_pref("network.protocol-handler.external.ssh", true);
user_pref("network.protocol-handler.warn-external.ssh", false);
user_pref("network.protocol-handler.expose.ssh", true);
user_pref("network.protocol-handler.app.ssh", \
[noLineBreak] "/PATHTO/NAME_OF_SSHHANDLER_HELPER_SCRIPT");
ssh handler helper script
#!/usr/bin/env bash

xterm -e ssh `echo $1 | sed -e "s/ssh:\/\///"`
#
# don't forget to set the script's exectuable flag
#


windows

execute (or combine) ssh.reg:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssh]
@="URL:ssh Protocol"
"URL Protocol"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssh\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,75,00,72,00,\
6c,00,2e,00,64,00,6c,00,6c,00,2c,00,30,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssh\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssh\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssh\shell\open\command]
@="c:\\Program Files\\SSH Communications Security\\ \
[noLineBreak] SSH Secure Shell for Workstations\\Sshhandler.cmd \"%1\""

save ssh.cmd in (e.g.) c:\Program Files\SSH Communications Security\SSH Secure Shell for Workstations\Sshhandler.cmd

@echo off
@FOR /F "tokens=2,3 delims=/@" %%a IN ("%~1") DO \
"c:\Program Files\SSH Secure Shell for Workstations\SSH Secure Shell for Workstations\ \
[noLineBreak] SshClient.exe" -u "%%a" -h "%%b"

rem ...DO start SshClient.exe - without quotes - works better;
rem but how does the path go into there without quotes...?

in case it doesn't work add the following lines to user.js:

user_pref("network.protocol-handler.external.ssh", true);
user_pref("network.protocol-handler.warn-external.ssh", false);
user_pref("network.protocol-handler.expose.ssh", true);

i happily give credit for this - and particularly the windows integration - to martisch_AT_uos.de (www.waldwolf.net)

No comments: