5

I often remotely connect via putty to client computers over ssh.

I would like to share my putty session so the client can see the commands I'm running from a web browser.

Is this possible to do?

Note I know it's possible to share a window using the Linux screen command.

  • yes its possible... there is a package in Mint's software repo that does this. If I come across it, ill post it. – Keltari May 14 '13 at 3:24
  • Can we assume that you are connecting from a windows machine to a Linux server? And that you have root access to the Linux machine? Is there a webserver running on the client Linux machines? – terdon May 14 '13 at 10:07
  • Yes I'm connecting to Linux from Windows via putty. Yes I have root. And yes a webserver is running. – anongeek May 14 '13 at 19:15
1

One way you can do this is saving the terminal session into a file and then accessing that file with a browser. Since your question gives very little information about your setup, I will assume that i) you are connecting to *nix clients, ii) the client can serve a webpage.

The main tool here is a program called script :

 script makes a typescript of everything printed on your termi‐
 nal.  It is useful for students who need a hardcopy record of an
 interactive session as proof of an assignment, as the typescript
 file can be printed out later with lpr(1).

You can install on Debian based distros using

sudo apt-get install script

Then create a simple HTML file on the remote machine with the following contents and save it as output.htm (make sure it is accessible from the internet):

<html>
<head>
 <meta http-equiv="refresh" content="2"> 
</head>

<body>
<pre>

The <meta> tag makes the page refresh every 2 seconds and the <pre> tag ensures that new lines and spaces are displayed correctly.

Now, once you log on to the remote machine run script -af output.htm. That will append (-a) a transcript of your terminal session to the file output.htm. Your client can then access http://remote.server.com/output.txt and watch the commands as they appear.

CAVEATS:

If you use colored output in your terminal, the ANSI escape sequences that make the colors will be visible in your html output.

  • Thank you terdon. I was hoping to be able to show terminal window activity in real time inside the browser. But this may be an alternative. – anongeek May 14 '13 at 19:10
  • Here comes your overdue first upvote. Time and time again I'm surprised how answers into which an author puts a lot of effort go unnoticed and unvoted. – 0xC0000022L May 7 '15 at 16:52
  • @0xC0000022L well shucks, thanks! – terdon May 7 '15 at 17:18
0

You need to checkout shellinabox. Here's a good tutorial. Enjoy!

http://www.tecmint.com/shell-in-a-box-a-web-based-ssh-terminal-to-access-remote-linux-servers/

  • Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. – Francisco Tapia Sep 11 '15 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.