Skip to content

Instantly share code, notes, and snippets.

@xpepper
Last active April 25, 2019 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xpepper/83ce7bc998d05d3564d4 to your computer and use it in GitHub Desktop.
Save xpepper/83ce7bc998d05d3564d4 to your computer and use it in GitHub Desktop.
Ssh tunneling and shared screen session

SSH reverse tunneling

In the following page will be explained the procedure to share a bash screen session in order to do remote peer programming. Example :

Person A : @work : Office Milan, behind a NAT

Person B : @home : in Paris, behind a NAT

Both of them, couldn't hold directly an ssh connection, so we need to choos a thirdy part server that both could reach :

Example :

Server it-ws-1 : that have a public ip reachable by both A and B

Now proceed as follow :

Supposing that Person A is the one in charge to hold the shared screen session, he will do on his computer :

ssh -l root -R 222:localhost:22   it-ws-1

After that, on the it-ws-1 , will appear a new socket, on localhost listening on the tcp port 222 :

tcp        0      0 0.0.0.0:222              0.0.0.0:*               LISTEN      1032/sshd

Now also the person B will login on the server it-ws-1 and after that, will do :

ssh -p222 root@localhost

This ssh will take advantage of the tunnel previously established , to reach the computer of the person A.

screen session shared

Open a screen with the following command :

screen -S <name of the session you wanna open>

Once you go into the screen session:

<ctrl+A>
:multiuser on

That's all! The only thing that the other collegue/collegues have to do in order to partecipate to the shared screen session is to type :

screen -x 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment