Consultant Life is Hard ep. I – Get that damn SSH X11 forwarding tunnel to work

This is probably more of a note to myself than anything else, since every time I have to do some sneaky X11 forwarding (e.g. to profile or perfomance tune a production server) it somehow never works the first time…having to waste at least 15, fundamentally boring, minutes to figure it out again.

Of course prerequisite is that you need to have some kind of X11 server running on your client, whose display will be forwarded to the server. Linux has it by default, Mac users can install it from the OS disks, for Windows users I suggest XMing to avoid the whole CygWin download).

So this is Gab self reminding recipe for that (tested from MacOS 10.6.8 to RHEL5):

  1. Make sure that
    "X11Forwarding Yes"

    is in your


    on the SERVER SIDE

  2. Make sure that
    "ForwardX11 yes"

    is your




    for Linux distros) on the CLIENT SIDE

  3. Login to the machine with
    ssh -X user@host
  4. If “echo $DISPLAY” does not display any meaningful value (e.g. host:display) then you typically miss libraries on the server side. From root or sudo your should issue at least (this worked for me on all RedHat based distros):
  • yum install xorg-x11-xauth
  • yum install libXtst
  • yum install libXi

At that point you might have to logout/login but the you should be able to run whatever X based application (e.g. JConsole, JProfiler, can you tell I use Java? :)) directly from the server and see the UI pop up on your client.

Never forget anymore Gab…and thanks for reminding to write this down my friend 🙂

3 thoughts on “Consultant Life is Hard ep. I – Get that damn SSH X11 forwarding tunnel to work

  1. Alternatively, you can enhance Alfresco to be able to stop and restart itself without needing ssh access itself. In many places, getting ssh access is near impossible due to security – only access is via Alfresco web interface.


  2. You mean restarting Alfresco via web thru port 80/8080? That is totally possible reloading the app via the Tomcat manager application, if you are using Tomcat. In general I am sure that, leaving PermGen errors apart, all J2EE appServers have a remote webapp reloading mechanism.

    Also here I was mostly talking about debugging and profiling purposes for which an SSH is a lifesaver….

    If instead you mean Alfresco should have a graphical window based service restart console, then I do not agree: honestly I still do not understand why there are companies using Windows on the server side, I don’t feel myself comfortable at all managing my server via a UI or having to motivate whenever I have to reboot 😉


  3. If you are unlucky enough, the remote server does not even have a graphical hardware… In this case Xvfb (virtual framebuffer) can save your day:

    export DISPLAY=:1
    Xvfb :1 -screen 0 1280x1024x16 &


Leave a Reply

Your email address will not be published. Required fields are marked *