The Schworak Site | Log In | Up One Level

Get FireFox to launch SSH or TELNET links under Linux

FireFox out of the box has issues running external links such as SSH or TELNET. The solution is quite simple. Just create a script that can do the work you want done and tell FireFox where that script is located.

In order to get FireFox to prompt you for the correct script location, you will need to modify a setting. The sample script below has all the instructions you need.

NOTICE: This script has no security checks in it. It assumes you will only click on links you know are valid. You can add validation as you see fit. Make sure you make your script executible with the chmod command.


#!/bin/bash
#
# In FireFox about:config add the the boolean protocol entry you need and set the value to FALSE
# When the link of that type is net used, you will be prompted for the handler to use. Select this script
#
#	network.protocol-handler.expose.[protocol-goes-here] = false
#
# Examples:
#
#	network.protocol-handler.expose.ssh = false
#	network.protocol-handler.expose.telnet = false
#
#
# When you click on a link, this script will run and perform the proper task.
#
# Examples:
#	
#	ssh://ssh.your-server.com
#	telnet://telent.another-server.com
#


cmd=`echo "$1" | tr -s "://" "\t"`
prot=`echo "$cmd" | cut -f 1`
addr=`echo "$cmd" | cut -f 2`

notify-send "$prot" "$addr"

gnome-terminal -e "$prot $addr"


Comments

All content on this site is copyright ©2004-2019 and is not to be reproduced without prior permission.