Open Source

How do I run a remote Linux desktop in Windows?

The ability to connect from Windows to Linux is all you need to make administrating from a central location much easier. Jack Wallen explains.

Recently I wrote an article "How Do I Connect to a Remote Windows 7 Desktop from a Linux Machine" and was asked to show how to do the same trick -- the other way around. You might assume this trick to be a challenge. You will be surprised how little of a challenge it really is.

But first off, you might be asking yourself "Why would I need this?" The answer is to use a single point of administration. How many times have you scurried around computers to try to resolve a problem only to have to waste time going back and forth. With the previous article, you were given the means to connect from Linux to Windows. Now, with the ability to connect from Windows to Linux, you have all you need to make administrating from a central location much easier. And with that said, let's get on with the setup.

This blog post is also available in PDF format in a free TechRepublic download.

Assumptions

First and foremost I am going to assume both Windows and Linux desktops are operating correctly and are on your local LAN. To make things simple, I will use the 192.168.1.x IP addressing. And, as you could assume, it's always easier (in this case) when the IP addresses are static (otherwise you will find yourself tracking down IP addresses of your desktop machines).

Software used

There are only two pieces of software necessary:

  • x11vnc: Installed on the Linux machine to use as the VNC server
  • TightVNC: Installed on the Windows machine to use as the VNC client

Installing the Windows software is straightforward for most users. Just download the installer and double-click. For many Windows users, the installation of the Linux software might not be as straightforward.

Of course, the Linux installation will depend on your distribution. But basically all you have to do is follow these steps:

  1. Open up your Add/Remove Software tool (such as Synaptic, Ubuntu Software Center, gnome-packagekit, etc).
  2. Search for "x11vnc" (no quotes).
  3. Select the results for installation.
  4. Click Apply to install.

Now, if you are more comfortable with the command line, you can install the Linux software like so:

  1. Open up a terminal window.
  2. Issue a command like sudo apt-get install x11vnc (this will depend on the distribution you use).

Once all the software is installed, you are ready to go.

The Linux side

This is really quite easy. All you have to do is start the x11vnc server. If you look at the manual page for x11vnc (issue the command man x11vnc), you will see numerous options available for the server. One of those options you might want to consider is the -forever option. If you don't add this option to the command, your x11vnc server will die as soon as the client quits the session.

So the command you will want to run, from the terminal, is:

x11vnc -forever

You will notice you do not get your prompt back. Even if you add the & character, x11vnc will not return you to your prompt. Because of this, you might want to consider adding a line like x11vnc -forever to the end of your /etc/rc.local file. This will ensure your x11vnc server is started at boot.

The Windows side

Now it's time to connect. You've already installed TightVNC on the Windows machine, so go to the Start menu and fire up TightVNC. When you open the tool, a small window will appear (Figure A) that allows you to enter an address for the connection as well as open the Options window.

Figure A

Make sure you select the Connection Profile that best matches your connection type.
In the Options window (Figure B), there are a number of items to configure. Unless you need a specific configuration, the default generally works pretty well.

Figure B

You will notice that you can set TightVNC in View mode, which effectively connects the client to a noninteractive session. This is always good for training purposes.
After you make all your configurations, click the Connect button, and the connection will be made (Figure C). The speed at which TightVNC runs will vary depending on the speed of your network. But you should find it to be a very workable solution.

Figure C

Select options and make the connection.

Final thoughts

And there you have it -- a simple way to make the connection between the Windows and the Linux desktops. Your administration world just got a bit easier.

Stay on top of the latest XP tips and tricks with TechRepublic's Windows XP newsletter, delivered every Thursday. Automatically sign up today!

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

57 comments
rajhanschinmay2
rajhanschinmay2

I am getting error on Windows machine when I am trying to login into Linux machine.Error says:

Error in TightVNC Viewer, a connection attempt failed because the connection party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

I have done all the steps needed and stated above.
Can anyone help.

digitaltoast
digitaltoast

Was having BIG problems downloading a 1.7gb Facebook archive via my 1.5Mb/s broadband. Used this to fire up a remote Firefox session on my Ubuntu VPS, et viola! Total time including download - 15 minutes. Thanks!

vikrant.korde
vikrant.korde

It worked like passing a hot knife through butter (makkhan mein garam churi). Regards, Vikrant Korde

Bebe56
Bebe56

Xming, the best there is.... nice, clean, easy... and FREE (well, you might want to send a VERY well-deserved donation). I'm using it for SLES 11 from a WinXP box.... i don't know about other distros but works great with SuSE... http://www.straightrunning.com/XmingNotes/

brianvu
brianvu

Hi Thanks Jack for the post. This is exactly what I need to have. I had problem installing the package on my 32-bit Oracle Enterprise Linux with the configure command as following. Please advise. Thanks configure: error: ========================================================================== *** A working X window system build environment is required to build *** x11vnc. Make sure any required X development packages are installed. If they are installed in non-standard locations, one can use the --x-includes=DIR and --x-libraries=DIR configure options or set the CPPFLAGS and LDFLAGS environment variables to indicate where the X window system header files and libraries may be found. On 64+32 bit machines you may need to point to lib64 or lib32 directories to pick up the correct word size. If you want to build x11vnc without X support (e.g. for -rawfb use only or for native Mac OS X), specify the --without-x configure option. ==========================================================================

hkphooey
hkphooey

You might want to take a look at the UltraVNC client for windows as well. It has a couple of other additions, in particular file transfer and encryption of the connection which is essential when doing VNC over an insecure network. An alternative is to tunnel it through ssh.

ghouart
ghouart

TeamViewer is also good for helpdesk. Runs on win,macosx and linux

gpacba
gpacba

With Xming it?s too better than VNC. Export X11 is the best way to access Linux desktops. And in the other side Rdesktop is the best option. In both cases we don?t need any especial instalation in the remote system. All is native. Regards Gustavo

gpacba
gpacba

With Xming it?s too better than VNC. Export X11 is the best way to access Linux desktops. And in the other side Rdeskyop is the best option. In both cases we don?t need any especial instalation in the remote system. All is native. Regards Gustavo

dosida1
dosida1

x2go is even easier to setup and install. I did it in less than 20 mins and didn't need to setup anything except the port sshd is listening to. - uses same FreeNX libraries - easy configuration (just add your users in a special group on the server) - KDE,Gnome,LXDE,RDP,Custom Sessions and single applications supported - KDE Control Panel for easy user management. - DHCP & TFTP server for Thin Client deployment Give it a shot... I'm sure you'll like it.

Photogenic Memory
Photogenic Memory

Install freeNX on your linux box. Generate a remote key for security. Then install Nomachine client on Windows. SSH into Linux server and copy and paste key into Nomachine configuration and save. Finally click on Nomachine client application and supply username and password for linux user account. Voila! Instant desktop. It took me 30 minutes to configure it out my first time. I was clueless. LOL!

ireaneus
ireaneus

Has anyone found a solution like logmein or PCAnywhere to connect to a linux box that say is at a home office from outside like from another home office? This would be setting up remote support, like viewing their xsession.

russoisraeli
russoisraeli

Hello Jack, Why don't you give a thorough tutorial on X and SSH port forwarding with PuTTY? It's a more advanced topic where you can't use Add/Remove Software, but it could provide indispensable to more advanced users and those willing to learn. - Igor

david.walker2
david.walker2

I've been running a similar setup with for over 2-1/2 years with no problem. In fact, the entire development team runs like this, from WinXP desktops to SuSE Linux Enterprise Server. I wrote a user script for the Linux side to start an Xvnc session with the desired desktop window size and window manager (some prefer Gnome, some prefer KDE). The users simply have to run the script once in a great while after I reboot the Linux system. In fact, I most often have to remind them of that. I also wrote a script to kill any or all sessions running for a user, and remove lock files, prior to (or just after) one of these infrequent reboots. The upside of this is that the TightVNC window can be closed on the WinXP desktop, as during a reboot of the desktop system, and the session stays intact on the Linux system. When the connection is made again, everything pops back up right where the user left it. The VNC connections make it so much easier to deal with multiple machines spread across three locations on two floors. For those things requiring a command-line, I also use telnet sessions to the required systems. Of course, some things just can't be solved with anything besides a personal visit to the console, but every little bit helps.

DanLM
DanLM

I am running tightvnc as a server on FreeBSD where I vnc into it from my windows machine. Again, using Tightvnc. When reviewing the Tightvnc's web site, I noticed NO mention of Linux. But further googling to forums, I find Tightvnc being used as a server on Linux also. So again, my question. Why 2 applications. I use right now tightvnc on my FreeBSD box as the server and tightvnc on my windows machines. To be truthful, I am currently typing this post through the vnc. Tightvnc running both on the windows machine AND the Unix machine.

RAETO
RAETO

God but an overkill solution ;) Use the build in XP(your desktop screenshot show this) or the build in W7 client to connect xrdp. You have nothing to change on linux if u host KDE or gnome or X11. It's only to install the xrdp package. ;) I use this on ten linux desktop with mostly debian5 and jaunty, intrepid and a version before. Decrese the number of used programs ;)

nahman77
nahman77

Putty could be usefull for SSH access

Neon Samurai
Neon Samurai

From X to W and now from W to X. The only recommendation I'd add is to use Aptitude rather than Apt-get. Aptitude maintains a record of what packages where installed by request and what where dragged along as dependencies. When you aptitude remove or aptitude purge; it references the record and additionally removes any dependencies installed only to support the requested program. Apt-get is a wonderful package manager but lacks the record of what was installed in addition to the requested package. And my unanswered question; can this share an existing user session or will it create a session per connection. When I last looked at it, it seemed to keep separate from the local user. The idea would basically be to have an equivalent of Remote Desktop (session per connection) and Remote Assistance (shared existing session). This seems to provide the remote desktop which can be very handy; especially between platforms. Can VNC instead connect into an existing user's desktop to see there perspective (remote assistance)? I'll dig through the x11vpn config and see if it's simply a setting somewhere but thought I'd ask here encase someone beats me to the solution. Thanks again for the article though. This balances out the last one very nicely. Anything that removes limitations between platforms is a good thing.

Mark W. Kaelin
Mark W. Kaelin

How many different operating systems are on your network? How do you handle the administration?

Editor's Picks