Part 10: SSH and X forwarding

X Windows is a minor topic associated with SSH. It is not as useful as Webmin, but there may be situations in which you need to use it and it is really easy to setup.

Consider a remote/headless server ... a Linux server without a keyboard or monitor attached, accessed and maintained solely over network connections using SSH in particular. Most of what you need to do to adminster it can be done from the SSH command line with useful tools such as htop, bmon, rtorrent, vim, apt-get, aptitude, mutt, nmap, etc.. If you need a GUI, the best thing to do is to install the excellent program Webmin which allows you to do just about anything to your server through a web browser interface. If for some reason, you need to run other GUI programs on a remote server you will probably need X Windows. "X Windows or X11 is a computer software system that provides a basis for graphical user interfaces (GUIs) for networked computers" (from http://en.wikipedia.org/wiki/X_Window_System)

The main reason I have used X Windows is to run conky on my various servers to see what's happening on them. At one point I was also running Konqueror -- a very powerful KDE file manager that does a whole lot more than just manage files. Other useful X11 programs are gkrellm and xinit. Anyway, if you need X Windows, SSH can forward all X Windows output to your computer.

How to set it up:

  1. Get Xming. This is the end of X Windows that will run on Microsoft Windows XP etc. You should pay the small fee to get the licensed version as it is much better than the public domain one.
  2. On your Linux server install the following packages:
    sudo apt-get install xterm xauth x11-apps
    I also installed "conky" which is a really nice system monitoring tool. You may have other X Windows software to install.
  3. Make sure that you have X forwarding enabled in PuTTY. Either add in the -X option if you are running it from the command line, or more likely, check the X-forwarding option in your PuTTY session and save it.
    (Category: Connection > SSH > X11	Enable X11 forwarding: enabled)
  4. Test by typing "xterm &" at the Linux command line (the "&" runs it in the background so that you can type other commands too). If you have Xming running, you should see a terminal window on your Windows computer. Another simple X program is xclock. Google "conky screenshots" and you can see the different system monitoring features that you can display using the conky program.

That's it.