View Full Version : X-Forwarding behind Router and SSH-server
prahn
02-22-2003, 07:44 PM
Hi!
In our company I have a router with NAT to connect the LAN with the Internet. The router has SSH-port-forwarding (22) to a OS X Server configured. I perfectly can tunnel VNC to almost every computer on the LAN with the -L flag: ssh 5901:Linux:5901 OSXServer
But how is it possible to X-forward anything from a Linux machine on the LAN via the OS X SSH Server to my Powerbook at home?
I would like to have X-Apps from A displayed on D:
A: RedHat Linux
B: Mac OS X SSH Server
C: DSL-Router
D: Powerbook
Possible?
Prahn
prahn,
Yes, it's possible, the connection can be forwarded to a port on a third machine at the other end. Read "More Advanced Use" from the VNC page "Making VNC more secure using SSH" here:
http://www.uk.research.att.com/vnc/sshvnc.html
prahn
02-23-2003, 03:32 AM
Thanks for your reply, but sorry, maybe I expressed it not really clear:
VNC tunneling works perfect!
But I want direct X-forwarding: Start a program on the remote and have it displayed on my local screen. The -X flag, y'know?!
Prahn
What's the problem with ssh -X, why you can't do:
A: RedHat Linux
B: Mac OS X SSH Server
C: DSL-Router
D: Powerbook
D: Powerbook > ssh "B: Mac OS X SSH Server",
B: Mac OS X SSH Server > ssh "A: RedHat Linux",
A: RedHat Linux > xterm.
The xterm will open on "D: Powerbook".
prahn
02-23-2003, 01:54 PM
Thank you again for your help. I already tried this, but I thought this would not work. Now, here is my error message after trying to start xterm:
xterm Xt error: Can't open display:
Do I have to set DISPLAY variables somewhere?!
Make sure the machine to which you are ssh'ing has
X11Forwarding yes
in its sshd_config file. If not, add it, then HUP sshd on that machine (kill -HUP <sshd_pid>).
prahn wrote:
Do I have to set DISPLAY variables somewhere?
No, if you use ssh -X, X forwarding and your DISPLAY environment variable on the remote host will automatically be set.
You are using "ssh -X user@remotehost" from the initial xterm, right?
prahn
02-23-2003, 04:20 PM
I checked both ssh servers, the OS X and the RedHat Linux, but "X11Forwarding yes" is set in both machines in the sshd_conf file.
I tried from AppleX11's xterm and from Terminal.app, both give the same error. I do:
ssh -X me@OSXserver
password (Login with public and private keys)
ssh -X someoneelse@RedHatLinux
password (Login without keys)
xterm
Maybe the different SSHs are problematic? Or the different Authentication methods?!
First, are any of the login files (/etc/profile, /etc/csh.login, ~/.login, ~/.profile, etc, depending on shell) setting DISPLAY automatically? sshd will set it for you, but if it's reset, then that's bad...When you log in, to what is DISPLAY set?
echo $DISPLAY
Otherwise, anything interesting when you run ssh verbosely?
ssh -vvv -X user@server
Near the end of the login procedure should be several lines concerning X11.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.