Weblog entry #10 for Utumno

Forwarding X via SSH
Posted by Utumno on Tue 27 Jun 2006 at 07:07
Tags: none.
I would like to run an X-based application on my remote server and have its window be displayed on my local screen. Both computers run Debian.

I know how to do it using the 'xhost' method ( http://www.debian.org/doc/manuals/reference/ch-tune.en.html#s-xhost ) but that's insecure. I would like to do that using SSH.

So I tried following a little howto from http://www.debian.org/doc/manuals/reference/ch-tune.en.html#s-xssh , i.e. I

1) set X11Forwarding and AllowTcpForwarding in remote's etc/ssh/ssh_config
2) restarted SSH on the remote comp
3) on local host, run ssh -X -l username remote.host
4) once there, I try running 'dvdstyler &' and I get

leszek@angband:~$ dvdstyler &
[1] 14114
leszek@angband:~$ Error: Unable to initialize gtk, is DISPLAY set properly?

[1]+ Exit 255 dvdstyler
leszek@angband:~$


What gives?

 

Comments on this Entry

Posted by Anonymous (213.164.xx.xx) on Tue 27 Jun 2006 at 08:04
Run this:
$ echo $DISPLAY
if it's your ip, then let us know!

[ Parent | Reply to this comment ]

Posted by Utumno (60.248.xx.xx) on Tue 27 Jun 2006 at 10:00
[ Send Message | View Utumno's Scratchpad | View Weblogs ]
the DISPLAY is not set, but

1) I thought it does not have to be ( SHH would transparently redirect X traffic to wherever I logged on from, wouldn't it? )

2) My 'local' comp does not have a routable IP, so I can't set DISPLAY on my server to point to it

[ Parent | Reply to this comment ]

Posted by Anonymous (213.164.xx.xx) on Tue 27 Jun 2006 at 10:07
Your error message tells you that the problem is that DISPLAY is not set.

> the DISPLAY is not set, but 1) I thought it does not have to be
No, it must be. SSH will set DISPLAY to something like localhost:10.0

> 2) My 'local' comp does not have a routable IP
SSH will handle this.

Is X installed on the remote box?

[ Parent | Reply to this comment ]

Posted by Anonymous (143.196.xx.xx) on Tue 27 Jun 2006 at 10:30

You should set X11Forwarding in remote /etc/ssh/sshd_config and not /etc/ssh/ssh_config.

Could be a typo in your post though.

Did you try a verbose ssh -v -X -l username remote.host?

You should see a line like this one :

debug1: Requesting X11 forwarding with authentication spoofing.

Also, check that $DISPLAY is set on local host.

[ Parent | Reply to this comment ]

Posted by Anonymous (131.155.xx.xx) on Thu 15 Feb 2007 at 10:08

Hi,

I have this problem, too. When I try to look for that line I also find this:

Remote: No xauth program; cannot forward with spoofing.

I search for a debian package with the name xauth, but I can't find it. Installing all X11 libraries is pointless for a computer without monitor, keyboard and mouse. I only have this problem with two machines running amd64 kernel and debian etch. All other boxes are amd32 with debian sarge. Any clue, someone?

I have to manually set the DISPLAY=local.host:0.0 and to run xhost +remote.host on the local.host.

Thank you,
Ionel

[ Parent | Reply to this comment ]

Posted by Anonymous (82.255.xx.xx) on Tue 27 Jun 2006 at 20:22
Your ssh daemon must accept to forward X11 protocol when asked from your client. Doing that on ssh_config is useless. You have to set "X11Forwarding yes" into /etc/ssh/sshd_config in your server, not /etc/ssh/ssh_config (note the "d").

[ Parent | Reply to this comment ]

Posted by dkg (216.254.xx.xx) on Wed 28 Jun 2006 at 05:04
[ Send Message | View dkg's Scratchpad | View Weblogs ]
Anonymous is right.

You need to ensure that your server's /etc/ssh/sshd_config contains the line:

X11Forwarding yes
Modern ssh clients will also default to being very untrusting of forwarded X11 connections, which may break some poorly-written X apps. This is the ForwardX11Trusted setting, and it is a per-client setting. (read man ssh_config for details).

Note that the debian ssh packagers have decided to default ForwardX11Trusted to yes (i.e. less secure) in the standard debian openssh-client install, which is different than upstream's stated preference. You can restore upstream's preference on your machine by adding the following line to /etc/ssh/ssh_config (default settings for all clients on the system) or in ~/.ssh/config (default settings just for your account):

ForwardX11Trusted no

If you are sure that you trust the remote host, you can use -Y instead of -X in your ssh invocation to force ForwardX11Trusted to yes. But beware that doing so means that remote clients can steal or tamper with data provided by the other windows in your X11 session.

[ Parent | Reply to this comment ]

Posted by Utumno (60.248.xx.xx) on Wed 28 Jun 2006 at 06:31
[ Send Message | View Utumno's Scratchpad | View Weblogs ]
Thanks Anonymous, dkg. It was the 'ssh_config vs. sshd_config' issue. I enabled X11Forwarding in sshd_config , and everything works now ( although it is slower than I expected )

[ Parent | Reply to this comment ]

Posted by Anonymous (213.164.xx.xx) on Wed 28 Jun 2006 at 09:13
ssh -CX hostname

[ Parent | Reply to this comment ]

Posted by Anonymous (24.34.xx.xx) on Sun 29 Jul 2007 at 03:35
install some x package, make your debian can do xauth;

then you can fix the problem of "DISPLAY is not set";


# set | grep DISPLAY
#
# aptitude install xutils xrsh xbase-clients

after relogin
=========================================================

/usr/bin/X11/xauth: creating new authority file /home/xqian/.Xauthority
xxxx@debian-31r3-x86:~$ set | grep DISPLAY
DISPLAY=localhost:10.0

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search