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:
- putty.exe – compiled putty.exe with the additional features
- putty.reg – Windows Registry file to register putty.exe to handle telnet, ssh and putty protocols
- unputty.reg – Windows Registry file to unregister putty.exe from the system
- 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
- diff.txt – the diff file for window.c file – for your reference only, you don’t need to do anything about it
- readme.txt – the file with information about this package
INSTALLATION:
- Put putty.exe into the directory where your current putty.exe resides
- Edit putty.reg to replace path to putty.exe with your path
- Merge putty.reg with your registry (usually, by double-clicking)
- Enjoy!
UNINSTALLATION:
- Run unputty.reg
- 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!
Comments(19)
Wonderful stuff, do not ever get rid of it!
very usefull
very nice stuff,but how can we specify a port other then 22
upendra:
Of course, you can! Try something like ssh://yourserver.com:1234
Thank you very much, now to get the writers of Putty Tray to include your patch.
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
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.
Just wanted to say this is the solution I’ve always been looking for. Keep up the great work!
can a password be specified as well?
how about firefox support?
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.
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.
What about firefox support? What kind of support are you referring to?
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.
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.
@maksym: I suppose the ability to put ’ssh://123.45.67.89′ into the addressbar of Firefox and to startup PuTTy.
Worked like a charm, you rule very much.
@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.
@Schubi: No, I’m not planning that, as that already works – at least with FF 3.5?