Home > OS >  Open Putty from a Webpage and run a specific command
Open Putty from a Webpage and run a specific command

Time:02-20

How can I open a Putty session and run a specific command on the click of a HTML Button.

I tried stuffs like creating a script and running it manually but could not figure out a way to implement it on the click of a button from the webpage. The command will be received from the user in the form of a text box.

CodePudding user response:

A webpage cannot do random stuff with software installed on local machine. That would be a security nightmare.

If you can register a protocol handler on the local machine, that can do, what you need, using information stored in a URL, then it's doable. For a first step, see HTML code to open PuTTY client from browser.

Though you will have to improve the handler to extract the command from the URL and pass it to PuTTY. E.g. by storing it to a local file and passing it to the PuTTY using -m switch.

The URL could be like runinputty://username@hostname/command – with all components (particularly the command) having been properly URL-encoded.

  • Related