Saturday, 8 December 2018

windows - Can PuTTY open SSH link similar to Terminal for Macintosh?


I’ve got a SSH link (ssh://) in 1Password that if I was using a Macintosh I could just click and have it open a session in Terminal. Is there a way to click an SSH link (ssh://) in Windows and have PuTTY open up the session?



Answer



PuTTY unfortunately does not associate itself with the ssh:// URLs.


You can associate an application with a protocol manually. See the MSDN article Registering an Application to a URI Scheme.


Basically you add a registry key like:


[HKEY_CLASSES_ROOT\ssh]
@="URL: SSH Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\ssh\DefaultIcon]
@="\"C:\\Program Files (x86)\\PuTTY\\PuTTY.exe\",0"

[HKEY_CLASSES_ROOT\ssh\shell]

[HKEY_CLASSES_ROOT\ssh\shell\open]

[HKEY_CLASSES_ROOT\ssh\shell\open\command]
@="\"C:\\Program Files (x86)\\PuTTY\\PuTTY.exe\""

Though the above passes a whole URL to the PuTTY command-line. And PuTTY does not understand the ssh:// prefix. So you would have to add a wrapper script that strips the ssh:// and passes only a user and a host to PuTTY.


For that see:
https://johnsofteng.wordpress.com/2009/05/12/launch-putty-from-browser/




I do not know 1Password, but a similar application KeePass can parse the URL and pass only its certain parts to the application. So it can strip the ssh:// for you.


See KeePass override rules.




On Windows, WinSCP 5.9 and newer registers itself to handle the ssh:// URL and opens the session specified by the URL in PuTTY.


(I'm the author of WinSCP)


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...