[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: remote x via ssh question

On Mon, Jan 01, 2001 at 10:21:47AM -0800, Forrest English wrote:

> i know i can export it just like i would any other time, but i
> also set X11Forwarding yes, which i belive should forward it
> automaticaly, and here's what i recive when i try and run
> [forrest@truffula forrest]$ xterm xterm Xt error: Can't open
> display:


Here is what works for me.

Let's say I want to ssh from host SSH-CLIENT to host SSH-SERVER.
On SSH-CLIENT I created a file $HOME/.ssh/config and added the
following lines to it:

	Host *
		ForwardX11 yes

That's it. When I ssh from SSH-CLIENT to SSH-SERVER, I can run
any X app from SSH-SERVER on the display of SSH-CLIENT. If you
want you can replace '*' by 'SSH-SERVER' for the X11 forwarding
to work for just that host. Note that the relevant option is
'ForwardX11 yes' and not the sshd_config option 'X11Forwarding

After starting an ssh session, and logging into SSH-SERVER, when
I do 'echo $DISPLAY' I get 'SSH-SERVER:10.0'. The 10 comes from
the sshd_config file in SSH-SERVER: 'X11DisplayOffset 10'. As far
as I know one should not set DISPLAY manually in an ssh session:
here's what the ssh(1) manpage says:

	The DISPLAY variable indicates the location of the X11
server. It is automatically set by ssh to point to a value of the
form ``hostname:n'' where hostname indicates the host where the
shell runs, and n is an integer >= 1.  ssh uses this special
value to forward X11 connections over the secure channel.  The
user should normally not set DISPLAY explicitly, as that will
render the X11 connection insecure (and will require the user to
manually copy any required authorization cookies)."


N. Raghavendra <raghu@mri.ernet.in> | Another year is gone -
Harish-Chandra Research Institute   | A travel hat on my head,
        GnuPG public key at:        | Straw sandals on my feet.
http://riemann.mri.ernet.in/~raghu/ |          -- Matsuo Basho

Reply to: