Blog Post:

Forward Linux X11 Session to Windows

Recently, I setup a Ubuntu machine. Although the Ubuntu machine was lying beside my Windows machine, I was looking to use the Linux machine remotely from my Windows PC so I don’t have to switch mouse and keyboard.

I regularly log into my desktop at work from home and for that I prefer to do VPN and use RDP (remote desktop protocol). I am very impressed with the quality of RDP sessions. With RDP, it’s easy to forget that you are working remotely. I had also tried various VNC software and Teamviewer for working remotely. However with these two tools, whenever I scroll through text, the text will blur for a moment before becoming clear and movement of mouse pointer isn’t very fluid, reminding me that I am working remotely.

I figured the reason for excellent performance from RDP is that RDP sends drawing operations to be performed whereas Teamviewer and VNC send the bitmap of the section of screen that has changed like the techniques used in Video compression. Therefore I was obviously interested in a technology that can forward drawing operations like RDP instead of bitmap.


I had previously known that it’s possible to forward the Linux’s X11 (most prevalent windowing system in Linux world) session which essentially forwards the drawing operations like RDP but I had never done it and wasn’t sure if X11 session can be forwarded to Windows machine. Poking around I found that it is possible and this is how I was able to forward Linux X11 desktop to Windows.

Ubuntu settings

First of install the openssh-server

  • sudo apt-get install openssh-server

Edit /etc/ssh/ssh_config to have the following settings

  • ForwardAgent yes
  • ForwardX11 yes
  • ForwardX11Trusted yes

Edit /etc/ssh/sshd_config to have the following setting

  • X11Forwarding yes

Windows settings

Download MobaXterm. There is a free portable edition available.

Start MobaXterm and click ‘Session’.
xterm_settings_ssh

Select ‘SSH’. Enter Ubuntu’s machine IP and the user account on Ubuntu. Check ‘X11-Forwarding’ option. My settings looked like
xterm_settings_ssh

In the terminal, type ‘gnome-session’.
xterm_terminal

Unity launcher not displaying on forwarded desktop

I didn’t figure out how to get the unity launcher to display in the forwarded desktop. However you can get the classic desktop (which I don’t mind using) by installing gnome-session-fallback.

  • sudo apt-get install gnome-session-fallback

And in MobaXterm, enter ‘gnome-session-fallback’ instead of entering ‘gnome-session’ to start the session.

Display X11 session in a Window

I noticed that the X11 desktop overlaps the Windows Desktop to the point that I cannot use Windows when running X Server. To fix it, go to the Settings->X11 and change the “X11 server display mode” to “Windowed mode”.
xterm_settings_x11

2 Responses

  1. Resurrecting the thread, since it was very helpful to me and I wanted to add something: “Unity launcher not displaying on forwarded desktop”

    The trick is not starting “gnome-desktop” or something like that, but actually entering “unity” in the terminal. This worked well on Ubuntu 16.04 LTS.

    Performance was a bit lackluster, even when using two i7-equipped test laptops connected through gigabit Ethernet.

Leave a Reply

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

Get in Touch

If you have a product design that you would like to discuss, a technical problem in need of a solution, or if you just wish you could add more capabilities to your existing engineering team, please contact us.