[[howto:desktop:seamless-remote-linux-desktop-in-windows]]

Posted 17 July 2009 by Brendan Kidwell

Seamless Remote Linux Desktop in Windows

This howto describes how to setup your Windows desktop to login remotely to a Linux host and run programs in local desktop windows. In other words, you get seamless access to local and remote apps without jamming all your remote apps into a remote desktop window. You will even be able to run the XFCE Menu application to provide an Applications menu for the remote host, and you get clipboard integration between local and remote windows.

My main motivation in writing this howto is actually XFCE's Application menu. There is plenty of instructional material out on the Internet showing you how to run X programs remotely, but if you want to go beyond launching a remote xterm window, launching and managing lots of other applications in the session is unintuitive; if you don't know what you're doing, you could end up with your xterm blocked while you run a GUI application, or it's not blocked, but it's getting all the debug output from the GUI applications you did launch.1) You might try just launching your favorite desktop environments with gnome-session or kde4-session but these don't behave as well as XFCE, and even XFCE needs a little bit of tweaking.

You will need:

  • A Windows host (the local machine you're sitting at) with:
    • Xming X server for Windows
    • PuTTY SSH client for Windows
  • A remote Linux host (in a virtual machine or elsewhere on your network) with:
    • XFCE Desktop environment
  • A medium-to-high bandwidth low-latency connection between local[/hostname] and [hostname]remote hosts. This scheme might not work so well over the Internet or a corporate WAN, because X11 protocol is known to produce lots of little packets. To do this over the Internet, look into NX.</li>

There are alternative X servers for Windows such as Cygwin/X, which is a little harder to install than Xming. And if you like, you can use Cygwin's ssh command instead of PuTTY. Choose your own adventure and adjust my instructions accordingly.

23 Oct 2009: Oops! I need to rewrite this article! I figured out that if you log into your virtual machine and launch lxpanel (package name lxpanel) instead of xfce4-session, you'll get a nice launcher panel and no unclosable “Desktop” window. Read through the rest of this article, but try using lxpanel instead of xfce4-session.

Login to the remote host as your normally would for command prompt access. Ensure that you have OpenSSH Server and XFCE Desktop Environment installed. If you are using Ubuntu you should run this command:

sudo apt-get install openssh-server xfce4

For other Linux distributions and other Unix operating systems, see your documentation for how to install these two packages.

If you haven't already installed PuTTY as your method for command prompt/text-only remote login, go to the PuTTY Download Page and download putty-X.XX-installer.exe and run it.

Go to the Xming home page, look under the headings Xming Server → Releases → Public Domain Releases and download and run Xming-mesa. (Of course, if you have an Xming Donor account, download from the newer “Website Releases” heading instead.)

Once you have Xming installed, run Start → Programs → Xming → XLaunch.

On the first page of the wizard, Select display settings, choose Multiple windows.

Next, in Select how to start Xming choose Start a program.

Next, in Enter or choose onr X client… fill in

Start program xfce4-session
Using PuTTY (plink.exe) checked
Connect to computer remote
(Fill in the actual hostname or IP address of the remote host!)
Login as user your username on remote host
Password your password

For security, your password will not be saved by default.

Click Next and you are prompted for the location of plink.exe. You will probably find it in C:\Program Files\PuTTY. Navigate to that folder, select plink.exe and click Open.

Next, in “Specify parameter settings” keep the defaults.

Next, in “Configuration complete”, choose whether or not to save your password and click Save configuration. You can save it under C:\Users\Me\Desktop\remote.xlaunch, for example.

At the end of the wizard, you can click Finish to go ahead and launch Xming, plink, and (remotely) xfce4-session. If all goes well, you will get a desktop, composed of one or two xfce4-panel windows, and a full screen desktop window (xfdesktop).

Don't worry if your desktop looks different or plainer than mine; the default configuration of XFCE will be different from one distribution to the next, and the host you see in my screenshot actually has Ubuntu's more comprehensive xubuntu-desktop package installed. Also don't worry that your Windows taskbar is covered up. We can fix these issues.

Right-click on one of the xfce4-panel windows (the grey toolbars in my screenshot) and click Customize Panel. Optionally, using the circle-slash () Remove the currently selected panel button, remove all but one of the panels.

Change the remaining panel(s) to Freely moveable and Close the “Customize Panel” dialog box.

Now it should be apparent that although the Desktop xfdesktop window is as large as your screen, it also has a titlebar. Click its minimize button to make it disappear.

Unfortunately, I don't know how to login to a full XFCE session with full GTK+ theme and font support and without xfdesktop being launched. But this is good enough for me, if you just have to minimize the Desktop window after you log in.

Now your desktop should look something like this:

Feel free to move your panel(s) around the desktop and add and remove panel Items from them. You shouldn't need the “Task List” or “Window List” Items because the Windows taskbar works just fine and so does its task switcher (Alt+Tab):

There are a couple of gotchas you should be aware of:

  • When you move a panel by clicking and dragging its handle on either end, you may have to move your pointer slowly to avoid running the cursor off the edge of the panel window and losing the “drag” action.
  • The xfce4-panel windows will be always-on-top. To prevent Panels overlapping other things on your desktop, you'll probably want to reduce the number of Items on them to just the bare essentials — the Applications Menu, Quit, and a shortcut or two — and/or also avoid maximizing any application windows.

Click the Quit button on your Panel.

If you deleted the Quit button, right-click on the Panel, choose Add New Items and add the Action Buttons Item.

Inside the “Log out” dialog box, click Log out.

After the XFCE Desktop session disappears, right-click on the “Xming” icon in the system tray and click Exit.

Xming will warn you that “There are currently 11 clients connected.” Those are just background XFCE tasks that didn't terminate during Logout. Click Exit and they will be terminated.

Navigate to where you saved your remote.xlaunch file and double-click it.

If your XFCE Panels are all out of whack or you just want to start over with your XFCE Desktop configuration for any other reason, just log in to your remote host with your usual text-only method and run these commands:

cd ~/.config
rm -r xfce4
rm -r xfce4-session

1)
The simple solution for launching a GUI app from an xterm is to run “[command] >/dev/null 2>/dev/null &”, but who wants to type all that every time?
jon, 2013-09-25 10:54

A little late to the party, but I just wanted to thank you for this tutorial. Xming had me a bit stumped and this worked really well. Thank you!

Simon Egli, 2017-01-13 01:39

Hi, to avoid xdesktop, just launch xfce4-panel, instead of xfce4-desktop

Brendan Kidwell, 2017-04-10 20:15

Sorry I took so long to approve this comment.

To comment on this page, please copy and paste the following into an email and send it to me. Useful and informative comments will be published within a day or two.

To: brendan@glump.net
Subject: Glump.net comment - Seamless Remote Linux Desktop in Windows

Regarding: http://www.glump.net/howto/desktop/seamless-remote-linux-desktop-in-windows
My name: [your name here]
My social media or web site: [optional URL here]
Publish this comment: yes

[your comment here]