Remote X applications (Re: [Techtalk] Re: Discovering my IP address)

John Clarke johnc+linuxchix at kirriwa.net
Mon Mar 15 19:08:03 EST 2004


On Mon, Mar 15, 2004 at 05:41:52PM +1100, Sue Stones wrote:
> On Mon, 15 Mar 2004 04:33 pm, John Clarke wrote:
> > If sshd is running on the remote server and supports password
> > authentication, simply running:
> >
> >     ssh remote_user at remote_host
> >
> > should ask you for your password and give you a remote shell.  You may
> > need to add '-X' to enable X11 forwarding.
> 
> How wonderfully easy.  But it still doesn't open the windows that I need, 
> (with or without -X).

Can you connect to the remote host with ssh?

Do you get any error or warning messages when you connect?

What's the value of $DISPLAY on the remote host?  I'd expect it to be
something like localhost:10.

Is there something listening on port 6010 of the remote host?

Are you trying to run Matlab on the same machine that you've logged in
to with ssh?

Here's a sample session, connecting from my work machine to home:

    [johnc at dropbear ~/tmp]$ ssh -X dropbear.kirriwa.net
    Last login: Mon Mar 15 15:10:02 2004 from wombat.vastsystems.com.au
    [johnc at dropbear ~]$ echo $DISPLAY
    localhost:10.0
    [johnc at dropbear ~]$ netstat -atn|grep 6010  
    tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN

Note that it's only listening on the loopback interface, which means
you can only forward X11 from this host, not from any other host on the
network.  The port number might not be 6010 - that's the default, but
it is configurable.  The number is 6000 + the display number from
$DISPLAY.

If I do:

    [johnc at dropbear ~]$ xterm &

an xterm window pops up on my desktop at work:

    [johnc at dropbear ~]$ hostname
    dropbear.kirriwa.net
    [johnc at dropbear ~]$ echo $DISPLAY
    localhost:10.0

To get this far requires that X11 forwarding be enabled in the sshd
config file on the remote server, in this example, my home machine:

    [root at dropbear ~]# grep X11 /etc/ssh/sshd_config
    # X11
    X11Forwarding yes
    X11DisplayOffset 10

If it's not enabled, X11 forwarding is blocked without any warning or
error message when I connect.  Also, $DISPLAY remains unset and there's
nothing listening on port 6010.  This is what that session looks like:

    [johnc at dropbear ~/tmp]$ ssh -X dropbear.kirriwa.net
    Last login: Mon Mar 15 17:52:38 2004 from wombat.vastsystems.com.au
    [johnc at dropbear ~]$ echo $DISPLAY
    
    [johnc at dropbear ~]$ netstat -atn|grep 6010
    [johnc at dropbear ~]$ xterm &
    xterm Xt error: Can't open display: 


Cheers,

John
-- 
IE 4 on Solaris took half an hour to setup on first run on a
Ultra 5. Nice to see that it is even more evil now.
                -- Dave Jacoby


More information about the Techtalk mailing list