X Windows: Remote X to Linux

From SlackWiki
Revision as of 12:59, 30 August 2012 by Arfon (talk | contribs) (ADDED: X11 over SSH)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

NOTE: In the X11 world, the SERVER machine is the one listening for a connection (the local machine (your desktop)).
NOTE: The CLIENT machine is the one initiating the connection (the remote machine).
I know, it sounds backwards but, it is actually correct if you understand the X11 connection.



Plain Ol' Vanilla X11 Remote Connection

1) Tell your X11 server machine (your desktop) to accept X11 connections from the client machine.

  • If it's a one time connection, just run the following from the command line

or

  • You can add the following to .bashrc or .profile to make it permanent
    xhost +X11_SERVER_IP  (the remote machine)
    
    EXAMPLE: xhost +192.168.1.45

2) Start the connection from the Client Linux machine (the remote machine)- Connect to the remote Linux machine via ssh/telnet/rlogin/whatever and run:

     DISPLAY=X11_SERVER_IP:0;export DISPLAY;APPLICATION_YOU_WANT_TO_RUN &
     
     EXAMPLE: DISPLAY=192.168.1.10:0;export DISPLAY;xterm &
     
     REMEMBER: The X11 server is your desktop.

Remote X11 Over SSH

1) ensure that X11Forwarding is enabled in /etc/ssh/sshd_conf on the remote machine.

2) ensure that X11Forwarding is enabled in /etc/ssh/ssh_conf on the local machine.

3) open an X11 forwarded ssh session from the local machine to the remote machine (opposite of what you do for a 'vanilla' remote X connection):

    ssh -X USER@REMOTE_MACHINE 
    XAPPLICATION_YOU_WANT_TO_RUN
    
    EXAMPLE:
    ssh -X joe@192.168.1.45
    xterm &

PROBLEMS
PROBLEM: ssh connection is complaining about an “Invalid MIT-MAGIC-COOKIE”.
FIX: start a less secure ssh session:

    ssh -Y USER@REMOTE_MACHINE