Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3324
  • Last Modified:

ssh tunneling to a terminal services

Hello,

I've been trying to ssh tunnel to connect to a machine via terminal services without success.

This is my setup,

From home i'm able to ssh tunnel to a machine at my work network and forward port 80 to my machine at home with no problem.  But now i need to do this for terminal services.

I use cygwin to ssh to a linux server in my network then when i try to forward port 3389 to the terminal service machine and it fails.

on the Linux server i use the following command   ssh -L 3389:localhost:3389  user@linuxserver

Another thing is also that i would have to somehow use a gui so that i can launch the terminal services screen so i've compiled cygwin with xfree86.


Basically i just want to get some suggestions on what would be the correct path for me to do this.

thx
G.

0
m3m0
Asked:
m3m0
  • 3
  • 2
  • 2
  • +2
1 Solution
 
Fatal_ExceptionCommented:
Whew!  You might want to put this into the Linux area if you don't get help here.  Certainly out of my boundary.  Just a thought in case you don't get help, but there are some real good experts here who might join in.

FE  
0
 
m3m0Author Commented:
Great thank you.
0
 
yuzhCommented:
"i would have to somehow use a gui so that i can launch the terminal services screen so i've compiled cygwin with xfree86."

All you need to do is to enable X forward at both client and server for your secure
shell:

have a look at the following pages about how:
http://www.experts-exchange.com/Operating_Systems/Linux/Q_20667995.html
http://www.experts-exchange.com/Operating_Systems/X_Windows/Q_20700965.html


0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
Fatal_ExceptionCommented:
That is what we needed, a Unix Master!  :)

FE
0
 
marko020397Commented:
I am using this ssh tunneling for a long time now for terminal services and it works great.

You are not specific in your question how exactly you would like to connect. Let's
asume you are running ssh on some Windows machine in network "one". You want
to connect to another Windows machin in network "two" where you also have a Linux
server.

1. I think the ssh command you are using is wrong. It should be:
   ssh -L 3386:win_server_on_nwetork_two:3389  user@linuxserver
  That way you are connecting to Linux server and make a tunnel to Windows machine.
  As you can see I have changed the first port number. We'll get to that later.

2. Now you have the tunnel from your Windows machine on network one to Linux server.
  That tunnel opens (ends) on Linux server and goes on port 3389 to Windows machine.

3. Now you have to run your Terminal Services Client and connect to localhost on port 3386.
   You may have your own Terminal Services Server on the machine you are connecting
   from. If you use 3389 on both sides of ssh it will conflict with the Terminal Server running
   on machine when ssh is running.

Now a few tricks. How can you connect to localhost:3386.

Windows 2000 and older:
You have to set your terminal services connection to connect to localhost. Then save it and
open the saved file with notepad and change the port to 3386.

Windows XP, 2003:
Windows XP and 2003 do not allow connections to localhost. You need to copy two files
from \Windows\System32 directory to another location. The files are mstsc.exe and
mstscax.dll. Open properties for mstsc.exe on new location and set Windows 98 compatibility
mode. Now you can connect to localhost:3386. You don't have to save the connection in
XP and 2003 you can just specify port along with location. (localhost:3386).

I hope this will help you. If you have any more questions just ask.
0
 
yuzhCommented:
X tunneling also works between *nix and secure shell client for Windows,
(please remember to enable X11 tunneling in your windows ssh client).

If you setup X tunneling properly, the ssh can automatically setup the DISPLAY
value for you. and you can run you GUI app (including your terminal services,
inside the ssh connetion).
0
 
GnsCommented:
Yes, I think Greg(yuzh) is on to an alternative to markos suggestion here. Instead of going through the hassle of setting up RDP forwarding via the linux box, be sure to install rdesktop on the linux machine, start XWin (at home), ssh -X (to work/linux), rdesktop terminal server....:-)

Slightly cumbersome any way you turn it:-).

-- Glenn
0
 
GnsCommented:
rdesktop homepage: http://www.rdesktop.org/

-- Glenn
0
 
m3m0Author Commented:
Damm all you guys Rock!  I wish i could you all points for just looking at my question :-)  

In any case I was more confortable with Markos suggestion which worked.  BUt i''ll try the rest as well.  So I'll be awarding points to Markos.

Again, I aprecieate all the help and comments.

thanks

-G
0
 
Fatal_ExceptionCommented:
Speaking for everyone here, am glad we could be of service.  BTW:  your company hiring?  :)  Just kidding.

Have a Happy Holiday Season.

FE
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now