≡ Menu

How to Tunnel X Windows Securely over SSH

Q. How do I tunnel X Windows Securely over SSH? I’d like to run X program on my remote Linux server and get back display to Laptop computer connected by high speed internet?

A. A tunneling protocol is a network protocol which encapsulates a payload protocol, acting as a payload protocol. Reasons to tunnel include carrying a payload over an incompatible delivery network, or to provide a secure path through an untrusted network.

SSH is frequently used to tunnel insecure traffic over the Internet in a secure way. Simply type the following command:

$ ssh -X user@server.corp.com
$ ssh -X user@

You can requests compression of all data to improve up user experience (good for a low speed link such as wan link) using -c option:
$ ssh -c -X user@

Once logged in type any X windows program name such as:
$ xeys &
$ oowriter &

To start kde type:
$ startkde &

To start default desktop type:
$ startx

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 4 comments… add one }
  • Bruno November 21, 2007, 2:03 pm

    I can help to say that at least for me, FreeNX from NoMachine has been easy and reliable. I use it a lot from a windows PC and a MacOSX. Configuring a HTTP Proxy is very simple too

  • wekker-tiktak February 2, 2008, 10:27 am

    To run qemu to start a virtual machine, on a remote host you need to use the command ssh -Y instead of -X, ssh -X results in an error message without starting an remote virtual machine.

    -Y Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls.

    When the sshd server is configured with “X11Forwarding no”, try the following to run remote x xlients:
    1. xhost +localhost
    2. ssh -R 6000: test@ahost
    3. On remote ahost export DISPLAY=

  • frater mus December 30, 2011, 3:35 pm

    ssh -C = compression
    ssh -c = cipher

  • joon September 28, 2014, 8:41 am

    I’m a beginner in linux – please be kind.
    Let me ask a dumb question – in order to tunnel GUI apps over ssh – does the server machine have to have a GUI desktop like gnome installed in order for this to work?

    Or does it just need X installed?

    I wish to establish multiple sessions for different users.


Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , ,