HTML code to open PuTTY client from browser

后端 未结 2 921
难免孤独
难免孤独 2020-12-17 02:52

I am trying to make a webpage which will have the entire inventory of servers that our team manages in the form of a table. I am using a simple LAMP stack and the inventory

2条回答
  •  执念已碎
    2020-12-17 03:35

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

    You can associate an application with a protocol manually. But it's not trivial. For instructions, see below.

    Easier way is to install WinSCP SFTP client. WinSCP 5.9 and newer registers itself to handle the ssh:// URL and opens the session specified by the URL in PuTTY.

    So basically, if you just install WinSCP, it will make PuTTY handle the ssh:// URLs, without the below manual tweaks.

    (I'm the author of WinSCP)


    To register an application 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/


提交回复
热议问题