X Windows

 

X Windows

 

Overview

X Windows offers a GUI interface to UNIX boxes.

On the server side, an X Server daemon needs to be running. On the client side, an "xterm" client program needs to be running.

There are a variety of ways to configure X-Windows clients


 

Start X Windows server

Configure permissions:

xhost +

or

xhost +remote_host

Note that one cannot su to another user and run xwindows unless an "xhost new_username" is done before the su by old_username

It will come back with the following line:

remote_host being added to access control list.

It means remote_host is given permission to display it's client on local_host.

To give permission to a certain machine permanently, create a file called X0.hosts file in /etc directory and put the hostname of the machine to which you want to give permanent permission.

If you don't give the xhost command and try to display remote client, then you will get the following error message:

Xlib: connection to "local_host:0.0" refused by server
Xlib: Server is not authorised to connect to host
X Toolkit Error: Can't open display


Amazone PEM and PuTTY PPK

If you are given a PEM file to use for authentication...

  1. Download PuTTYgen

  2. Run: puttygen.exe

  3. To convert an Amazon key to a PuTTY key, use the menu option...

      Conversions | Import Key

  4. Load the .pem file that you downloaded

  5. Press the Save Private Key button.

    Ignore warning about the leaving the passphrase blank.

  6. Save the file to the location that PuTTY has been configured to look in for it's keys.

  7. Configure putty to use new *.ppk file...


PEM with scp

scp -i <path_to_keyfile> <local_file_to_copy> <destination_username>@<destination_host>:<destination_path>

Example:


Use Mocha X and putty to start an X-Windows client

  1. Download Mocha X and start the Mocha X server

  2. In putty, enable X11 Forwarding and set X display location to localhost

  3. Log on to your linux box

  4. Run...

      xauth list

    ...and copy output. For example...

      hostname0a/unix:10 MIT-MAGIC-COOKIE-1 06eccfef8f06993f48fb059adeda8376

  5. sudo to your desired user

  6. Run...

      xauth add

    ...and paste contents of xauth list command. For example

      xauth add hostname0a/unix:10 MIT-MAGIC-COOKIE-1 06eccfef8f06993f48fb059adeda8376

  7. Run xclock to test


Use xterm as X Windows client

  1. Open an xterm window

  2. ssh to your server

    ssh hostname

  3. Set the DISPLAY variable

    DISPLAY=client_hostname:0.0
    export DISPLAY

  4. Test the X Windows session by running a GUI clock

    xclock

  5. If that works, go ahead and spawn an X Windows terminal session:

    xterm