HTML code to open PuTTY client from browser

I am trying to create a web page that will have all the inventory of servers that our team manages in a table. I am using a simple LAMP stack and inventory entry as a CSV file.

The table has three columns: Host name, IP address and device serial number.

While this works fine, I want to do it even further and make each IP address in the table a hyperlink, clicking on which will open an SSH client that will connect to this IP address. Any clues on how to do this? I was hoping there would be something like the mailto: tag that the mail client opens (Outlook window).

+4
source share
2 answers

I did this after the information about this blog post .

For future reference, if the original page is missing, here is the process:

  • you cannot map the ssh: // schema directly to PuTTY, but you can map it to a script proxy, which in turn will contain PuTTY with the correct arguments. Mine is called putty_ssh.bat and has the following content:

     @echo off set var=%1 set extract=%var:~6,-1% "C:\Program Files (x86)\PuTTY\putty.exe" %extract% 
  • The script must be registered in the registry. You can simply create the ssh.reg file with the following contents and open it (if necessary, configure the last line):

     REGEDIT4 [HKEY_CLASSES_ROOT\ssh] @="URL:ssh Protocol" "URL Protocol"="" [HKEY_CLASSES_ROOT\ssh\shell] [HKEY_CLASSES_ROOT\ssh\shell\open] [HKEY_CLASSES_ROOT\ssh\shell\open\command] @="\"C:\\path\\to\\putty_ssh.bat\" %1" 

When I click on ssh: // links on web pages, PuTTY now opens.

+7
source

PuTTY, unfortunately, does not bind itself to ssh:// or any other URLs.

You can associate the application with the protocol manually. But this is not trivial. See below for instructions.

The easiest way to install WinSCP SFTP client . WinSCP 5.9 and newer registers to handle the ssh:// URL and opens the session specified by the PuTTY URL .

Basically, if you just install WinSCP, this will make PuTTY handle the ssh:// URL without manual settings.

(I am the author of WinSCP)


To register an application manually, see the MSDN article Registering an Application in a URI Scheme .

Basically you add a registry key, for example:

 [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\"" 

Although the above is the full PuTTY command line URL. And PuTTY does not understand the ssh:// prefix. Thus, you will need to add a shell script that breaks ssh:// and passes only PuTTY to the user and host.

To do this, see:
https://johnsofteng.wordpress.com/2009/05/12/launch-putty-from-browser/


+3
source

Source: https://habr.com/ru/post/1491580/


All Articles