Remote X over ssh

Bill Campbell linux-sxs
Wed Jan 5 13:03:47 PST 2005


On Wed, Jan 05, 2005, Shawn Tayler wrote:
>On Tue, 4 Jan 2005 21:55:24 -0800 Bill Campbell <linux-sxs at celestial.com>
>exclaimed:
>
>> On Tue, Jan 04, 2005, Shawn Tayler wrote:
>> >On Tue, 04 Jan 2005 20:16:34 -0800 Ken Moffat <kmoffat at drizzle.com>
>> >exclaimed:
>> >
>> >> Shawn Tayler wrote:
>> >> 
>> >> >Ok Guys,
>> >> >
>> >> >All this X discussion has brought to mind an issue that I had put on
>> >a> >back burner.  I am trying to get a remotre X session on a PC over a
>> >LAN.> > I am
>> >> >using ssh to initially connect.  I have X Forwarding enabled in the
>> >> >sshdconfig file.  What are the other steps I need to accomplish?  the
>> >> >xhost+ and export DISPLAY 0.0:?  
>> >> >
>> >> >What would be the difference if I wanted to say have my local X
>> >session> >on cntl-alt-F7 anf the remote session appear on cntl-alt-F8? 
>> >Is thios> >possible?
>> >> >
>> ...
>> >> I enable forwarding in sshd_config using
>> >> 
>> >> X11Forwarding yes
>> >> 
>> >> and the call I use is
>> >> 
>> >> ssh -X servername
>> >> 
>> >> this runs the program on the server, but displays it on the client. 
>> >> Maybe not exactly what you want, but it's easy.
>> >> 
>> >
>> >This just gives me a text mode ssh session.  
>> 
>> Do you have a DISPLAY environment variable set in that ssh
>> session?  If so, you should be able to run X clients from that
>> session (e.g. run ``xeyes'').
>> 
>> NOTE:  Current versions of openssh require setting
>> ``ForwardX11Trusted yes'' in the ssh_config file.
>> 
>
>Yes
>
>I tried xeyes.  I get the "Can't open display :0.0" error.  What value
>should I set $DISPLAY to on the remote machine?

If you're seeing a DISPLAY=:0.0, it's not being set by the sshd process on
the remote machine.  The sshd DISPLAY will be either something like
localhost:10.0 or $FQDN.10.0 depending on the setting of the sshd_config
``X11UseLocalhost'' line (Linux seems happy with localhost:xx.0 while some
OS's require a real host name).

You have to have ``X11Forwarding yes'' in the sshd_config file on the
remote system, and either use the ``-X'' option in the ssh command or have
``ForwardX11 yes'' in the ssh_config file on the client machine.

BTW:  the command ``sshd -X -f $system xterm'' should start an xterm on the
remote machine where the ``-f'' option automatically deletes the local ssh
process.  I use this on a LAN connection, but run the xterm on my local
machine when going across slower links using this to start it:

	xterm -e ssh -l $user $system &

>I tried startx and kdeinit says it can't start either.

You probably don't want to use startx on the remote machine as that will
give you two window managers, one on your local box, and one on the remote.

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Systems, Inc.
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``A Democracy cannot exist as a permanent form of government.  It can only
exist until the voters discover they can vote themselves largesse out of
the public treasury.  From the moment on the majority always votes for the
candidate promising the most benefits from the public treasury with the
result that Democracy always collapses over a loose fiscal policy, always
to be followed by a Dictatorship.''
	Professor Alexander Fraser Tytler.  1801


More information about the Linux-users mailing list