PuTTY for Windows and ssh:// handler

I use PuTTY for Windows a lot. It is an excellent SSH, Telnet, etc, etc, terminal program.

On the other hand, I am very impatient user. I honestly believe that the users should never wait for computers, and that the letters should appear on the screen a microsecond before the user types them. This means that I hate moving my hands away from the keyboard to mouse to use a GUI interface, when the majority of work is actually typing text or code on the keyboard. This defines a lot of choices I make when selecting software on my computer.

Bundled together, I really do not appreciate opening PuTTY GUI interface just to double-click on some PuTTY profile and then move the hand back on the keyboard. A much faster way of doing this for me is to press “Win-R”, type in something along the lines of “ssh://myhost.com” and never move away from the keyboard. After a couple of Google searches, I know I am not alone in that. At least one of my colleagues prefers to do it this way as well. Speeds things up a lot, believe me.

The problem is that PuTTY does not support it. It supports telnet://192.168.0.1, but NOT ssh://192.168.0.1. Apparently, this is because PuTTY developers believe that the URL convention for SSH protocol hasn’t been approved yet and, therefore, PuTTY won’t support it. Some people even developed special tool – UrlConf – in particular, to be able to set up PuTTY as a default ssh:// handler. Some others use Windows batch files to parse command line passed to PuTTY and run it.

Both solutions are somewhat funny – they invoke a proxy application just to invoke PuTTY. As PuTTY is Open source distributed under MIT license, why don’t I update its source code to do what I need?

So here it is, PuTTY that can handle not only ssh:// protocol to the same extent it could handle telnet:// protocol, but also handles a special putty:// protocol.

CONTENT:

  1. putty.exe – compiled putty.exe with the additional features
  2. putty.reg – Windows Registry file to register putty.exe to handle telnet, ssh and putty protocols
  3. unputty.reg – Windows Registry file to unregister putty.exe from the system
  4. window.c – the only file that had to change to implement extra functionality – for your reference only, you don’t need to do anything about it
  5. diff.txt – the diff file for window.c file – for your reference only, you don’t need to do anything about it
  6. readme.txt – the file with information about this package

INSTALLATION:

  1. Put putty.exe into the directory where your current putty.exe resides
  2. Edit putty.reg to replace path to putty.exe with your path
  3. Merge putty.reg with your registry (usually, by double-clicking)
  4. Enjoy!

UNINSTALLATION:

  1. Run unputty.reg
  2. Enjoy!

CHANGELOG:

[*] Based off the source code for the latest Windows development version as of 14/09/2008

[+] Handles ssh:// protocol to the same extent as it handles telnet:// protocol. Namely, if you type something like “ssh://192.168.0.1″, and 192.168.0.1 runs SSH server, PuTTY would attempt to connect

[+] Handles putty:// protocol. This is a special protocol and, if invoked as “putty://profile-name”, would be equivalent to “putty.exe -load profile-name”. In other words, if you have profile-name defined in PuTTY, then typing “putty://profile-name” in Run menu or in browser, would invoke PuTTY, load profile-name and attempt to connect using its settings. If the profile contains spaces in it, please, put it in quotes: “putty://”profile name”"

Download the zip file here: putty_ssh

Have fun, folks!

19 Comments so far

  1. Michael Laccetti on October 21st, 2008

    Wonderful stuff, do not ever get rid of it! :)

  2. Giulio Cervera on November 5th, 2008

    very usefull

  3. upendra on November 10th, 2008

    very nice stuff,but how can we specify a port other then 22

  4. maksym on November 13th, 2008

    upendra:

    Of course, you can! Try something like ssh://yourserver.com:1234

  5. Patrick Kelso on November 27th, 2008

    Thank you very much, now to get the writers of Putty Tray to include your patch.

  6. Johan Högdahl on January 14th, 2009

    GOLD for me, observ that it can be combined with -load termsetting
    just make a nice termsetting wo address in putty, us colors and stuff,
    and it loads nice with your url. Was just going to rebuild it self when i found it done. thanks WM //johan

  7. Ben Johnson on January 15th, 2009

    Brilliant! I’m sure it must be more complicated than it looks, but I can’t understand why Simon T didn’t bother adding support for SSH in this way.

    Thanks again.

  8. Susan on February 10th, 2009

    Just wanted to say this is the solution I’ve always been looking for. Keep up the great work!

  9. J on February 16th, 2009

    can a password be specified as well?

  10. J on February 17th, 2009

    how about firefox support?

  11. maksym on March 21st, 2009

    It really is easy, and the only reason I believe the developers did not do it was because of a principle of not implementing “unapproved standards” – see the original blog about it.

  12. maksym on March 21st, 2009

    You can specify the username, like ssh://myuser@myserver.com:1234, but I’m not sure you can specify the password. You see, I’m a security expert and, as such, would not approve typing a password in command line, as God knows in which history it might end up. ;-)

  13. maksym on March 21st, 2009

    What about firefox support? What kind of support are you referring to?

  14. Mike on March 31st, 2009

    when I open ssh://username@hostname:22 I get:

    Using username “root”.
    Access denied
    root@123.45.67.89’s password:

    Any reason why it tries to authenticate first? I’d rather not have an access denied entry in the log because of a legitimate SSH request.

  15. Shadus on April 3rd, 2009

    Putty already allows you to specify user name and password on the command line for the ssh protocol. One place I worked used this command line in the “url” section of keepass to allow them to connect.

    cmd://C:\progra~1\putty\putty.exe -ssh {TITLE} -l {USERNAME} -pw {PASSWORD}

    Not as pretty as the protocol version, but it gets it done. If you assume that the ssh protocol uses the same syntax as the ftp protocol when used you would get syntax something like this…

    ssh://username:password@hostnameoripaddress

    Which is also more than the telnet: handler in putty supports also after a cursory look at the code.

  16. Schubi on May 28th, 2009

    @maksym: I suppose the ability to put ’ssh://123.45.67.89′ into the addressbar of Firefox and to startup PuTTy.

  17. Guillaume on June 10th, 2009

    Worked like a charm, you rule very much.

  18. maksym on November 6th, 2009

    @Mike: That’s because you’re likely to have a private key loaded in memory through pagent.exe – so putty.exe tries to authenticate with that key first. If it bothers you, create a profile for your 123.45.67.89 and check the box to authenticate using the usernames only.

  19. maksym on November 6th, 2009

    @Schubi: No, I’m not planning that, as that already works – at least with FF 3.5?

Leave a Reply