I am trying to set up a reverse ssh tunnel from a windows machine using Cygwin (openssh) , to a Linux server machine with static ip, so i can access the windows pc directly through the server from any other machine.
My ultimate goal is to be able to connect through remote desktop (rdp) to the windows pc from any other pc through the ubuntu server.
I managed to take the first step which is setup a ssh server in cygwin and to open a reverse ssh tunnel from windows pc to the server using the following command in cygwin :
ssh -nNT -R server-ip:5000:localhost:22 username@server-ip
So with tunnel running i can connect from any other pc to the windows pc with the following two steps:
1) connect to the linux server
2) connect to the windows pc using the tunnel created earlier
ssh username@localhost -p 5000
My first question is this :
Why can't i use directly the following command from any PC to connect directly to the tunnel:
ssh username@server-ip -p 5000 ssh: connect to host server-ip port 5000: Connection refused
Is there anyway to set this up?
Secondly, if i manage to do this, is there a way to forward rdp port so i can connect directly from any pc to the windows client using remote desktop protocol?
Using something like :
ssh -L 3390:localhost:3389 username@server-ip
Thanks in advance.