1

I want to connect my laptop and another machine together using synergy.

They are both on different networks, but I have successfully made a connection from my laptop to the desktop using an SSH tunnel through a publicly accessible machine on the desktop's network (Laptop -> Middle Machine -> Desktop). However, I would like to have the connection the other way round, Desktop -> Laptop. There is not a publicly accessible machine on my laptops network.

Can I run a command on my laptop which connects to the middle machine which opens a port tunnelling back to my laptop? My laptop is running Ubuntu, the other two machines are running CentOS.

Thank you

0

If you have a Middle Machine somewhere on the Internet where you can SSH into it both from Desktop and Laptop (the machines don't need to be on the same network at all), you can forward the traffic through Middle Machine quite easily:

Step 1 - SSH from Laptop to Middle Machine:
Laptop --------SSH-----> Middle Machine

Step 1b - set up a TCP tunnel back to Laptop:
Laptop --------SSH-----> Middle Machine
      <--RemoteForward--

Step 2 - SSH from Desktop to Middle Machine:
Laptop --------SSH-----> Middle Machine <--SSH-- Desktop
      <--RemoteForward--

Step 2b - set up a TCP tunnel through Middle Machine:
Laptop --------SSH----->   Middle Machine   <--SSH-- Desktop
      <--RemoteForward-- <--LocalForward--

Step 3 - SSH from Desktop through Middle Machine and RemoteForward to Laptop:
Laptop --------SSH----->   Middle Machine   <--SSH-- Desktop
       <--RemoteForward-- <--LocalForward-- <--SSH-- 

See this answer on SuperUser on how to set this up (in that answer, Middle Machine is named serverpc, Laptop is officepc, Desktop is homepc). There is some extra network and CPU overhead due to the fact that you're running SSH-through-SSH, but it is surprisingly usable.

All this can be done as normal user using vanilla SSH in default configuration. You can also use all the features of SSH in the final tunnel from Desktop to Laptop - SSHFS, X forwarding, agent forwarding, you-name-it.

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.