ssh and telnet protocol handler for Firefox

SSH and telnet protocol handler for Firefox

  1. save the following zsh script into a file (let’s call it ~/.scripts/firefox-handler.zsh) (if you don’t have zsh, install it using your package manager or fix the script to use whatever shell you want).
    #!/bin/zsh
    url=$1
    proto=${url//:*/}
    data=${${url//*:\/\//}%/}
    
    #makes -i $HOME/.ssh/id_rsa_foo work
    data=${data//\%20/ }
    data=${data//\$HOME/$HOME}
    #/makes -i $HOME/.ssh/id_rsa_foo work
    
    /usr/bin/gnome-terminal -e "$proto $data"
  2. chmod +x ~/.scripts/firefox-handler.zsh
  3. in Firefox go to about:config and add the following two strings (right-click -> new -> string) network.protocol-handler.app.ssh and network.protocol-handler.app.telnet and put nothing as the value (for a yet unknown reason, it doesn’t work if you specify the path to your script right now)

Restart Firefox, you should now be able to click on ssh and telnet links and also type those URIs in your location bar and it should ask you with what application you want to open it, you can now browse to the location of the previously created script and check the box « don’t ask me again ». As an added bonus, you can also use those URIs as bookmarks which I find quite handy.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s