Monday, February 10, 2014

My ssh protocol handler for Firefox and under Linux

#!/bin/bash
address=`echo $1 | sed -e "s/ssh:\/\///" | sed -e "s|:....||"`
str=$1
n=4
port=`echo ${str:${#str} - $n}`
gnome-terminal -e "ssh ${address} -p ${port}"



Put this in a file and set it as executable. I put mine in ~/.bin/sshhandler
(chmod +x ~/.bin/sshhandler)
in firefox go to about:config
add new boolean value called
network.protocol-handler.expose.ssh

Set it to false.

In Firefox navigate to an ssh:// url and select the script as the application to handle them.

This should handle urls formatted in the following manner:

ssh://user@hostname:port


No comments: