====== Seamless Remote Linux Desktop in Windows ====== Brendan Kidwell \\ [[brendan@glump.net]] 17 July 2009 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. {{:howto:seamless_linux:demo.png?480|}} 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.((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?)) 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: * [[http://www.straightrunning.com/XmingNotes/|Xming]] X server for Windows * [[http://www.chiark.greenend.org.uk/~sgtatham/putty/|PuTTY]] SSH client for Windows * A **''remote''** Linux host (in a virtual machine or elsewhere on your network) with: * [[http://www.xfce.org/|XFCE]] Desktop environment * A medium-to-high bandwidth **low-latency** connection between **''local''** and **''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 [[http://en.wikipedia.org/wiki/NX_technology|NX]]. There are alternative X servers for Windows such as [[http://x.cygwin.com/|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''.// ===== 1. Prepare your Remote Host ===== 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. ===== 2. Install and Configure PuTTY ===== If you haven't already installed PuTTY as your method for command prompt/text-only remote login, go to the [[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html|PuTTY Download Page]] and download "''putty-//X.XX//-installer.exe''" and run it. ===== 3. Install and Configure Xming ===== Go to the [[http://www.straightrunning.com/XmingNotes/|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''**. {{:howto:seamless_linux:xlaunch-1.png|}} Next, in "Select how to start Xming" choose **''Start a program''**. {{:howto:seamless_linux:xlaunch-2.png|}} 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. {{:howto:seamless_linux:xlaunch-3.png|}} 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. {{:howto:seamless_linux:xlaunch-4.png|}} 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. ===== 4. Configuring your Remote XFCE Desktop ===== 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''). {{:howto:seamless_linux:new-desktop.jpg?512|}} 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 ({{:howto:seamless_linux:unicode-prohibition-symbol.png|}}) "**''Remove the currently selected panel''**" button, remove all but one of the panels. {{:howto:seamless_linux:panel-customize.png|}} 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: {{:howto:seamless_linux:desktop-one-panel.png?512|}} 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 (A-Tab): {{:howto:seamless_linux:demo-alttab.png|}} 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. ===== Logging Out ===== Click the **''Quit''** button: {{:howto:seamless_linux:quit.png|}} 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''**. {{:howto:seamless_linux:systray-exit.png|}} 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. {{:howto:seamless_linux:xming-exit.png|}} ===== 5. Logging Back In After Your First Time ===== Navigate to where you saved your **''remote.xlaunch''** file and double-click it. {{:howto:seamless_linux:xlaunch-file.png|}} ===== 6. Oh Crap, I Screwed Up My XFCE Desktop! Help! ===== 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