Linux

Running remote sessions with NX on Linux or Solaris hosts

Marco Fioretti makes the case for using the NX client to run local or remote X sessions on Linux or Solaris hosts.

NX is the collective name for a protocol and a series of server and client programs for an apparently pointless, but in practice, really useful task: running local or remote X sessions on Linux or Solaris hosts.

In plain English, this means having the full graphical desktops you'd normally enjoy on a certain host computer (the NX server) on that computer or from remote ones running NX clients (including Windows or Mac boxes!), just as if you were sitting in front of the server. I'll explain why you would want to run an NX client and server on the same computer at the end, after looking at the basic features of NX.

What does NX really offer?

At first sight, NX may seem not much of a big deal, if not a useless piece of software: after all, running graphical applications remotely (network transparency in technical lingo) has been a wonderful, standard feature of the X Window system since the 80s. Strictly speaking, you don't need NX at all to run one or many Linux graphical programs remotely.

In practice, things are much different. As great as it is, the X Window protocol is terribly "network intensive". Even the simplest graphical operations, like mouse clicks, require so many round-trip communications between an X server and its client(s) that using X remotely can be a very frustrating experience, even on broadband connections.

NX, instead, greatly reduces the amount of bytes traveling across the network, thanks to few tricks. The first ones are packet compression and a cache that stores and reuses as many data as possible, instead of asking for them time and again. The function known as "lazy encoding" defers all screen updates to the last possible moment. Besides, several transmission parameters are automatically adjusted to match the current link speed and latency.

The end result is remote desktops that are much more usable than plain X ones, even if you use graphic-intensive applications, backgrounds, and desktop effects over very slow links!

On top of that, NX encrypts by default all traffic using standard SSH features, including passwordless logins with keys! The performance hit is negligible, unless you run NX on very, very limited computers. The software also supports connections to RDP and VNC servers.

NX is developed by NoMachine. There are both free and commercial versions of NX servers and clients, with different features. The GPL FreeNX server, for example, lacks the Samba, CIFS and CUPS printing support available in the main, official product. DEB and RPM packages for the free client are available from the NX website: in my experience, they run without any issue on recent versions of both Ubuntu and Fedora.

Configuring NXclient

NX is so efficient by default that you may not need any tweaking, but here are a few suggestions to get the most out of it.

To begin with, when you have finished using an NX client, you can either log out, that is actually end the remote session, or simply disconnect. In the second case, the next time you'll connect you'll find all the same windows you left open, all in exactly the same state. That's cool... unless the server does need more than you, to do something more urgent, the RAM you were leaving filled with your waiting session.

The first time you launch it, NXclient will start a very simple wizard, to let you configure the first remote connection. Just remember to choose "Available Area" for the NX window, if you work with a laptop attached every time to monitors of different sizes. You can change the settings in any moment, or add connections, by launching the client with the --wizard option.

You should also play with the buttons in the wizard's Advanced Configuration Panel (shown in Figure A), to find the combination that gives the best possible performances on your particular combination of client, server, and Internet connection.

The NXclient configuration is stored in plain text files, that you may copy and reuse on different computers, inside the $HOME/.nx folder: remember to add it to your backup plans, if you don't make copies of your whole $HOME!

The best for last: NX session shadowing

I mentioned at the beginning that you may start an X session with NXclient even on the same computer, in front of you, that runs the NX server. In practice, something as apparently pointless as this does make sense in a couple of situations. One is desktop sharing, possibly on multiple monitors, to teach Linux to somebody: thanks to NX, tutor and student may have separate sessions side by side, using only one computer.

You will find NX really useful even if you routinely use Unix or Linux graphical software that:

  • is so heavy that your own computers would take forever to run it, or...
  • cannot be installed on other computers, for licensing or other reasons, or...
  • takes so long to complete each single run (a typical case with many CAD simulators) that you can't log out, that is stop the application and restart it via SSH from home: you would lose a day's worth of work!

What should you do in such cases? Order take out food and spend long hours in the office alone? No way!

The solution is to start working on your office computer into an NX session, leave it there, go home, and use NXclient to connect (instead of starting a new session) to that same session already running in your office computer!

NX calls this trick session shadowing. Select that when you configure a new NXclient session and you'll be all set! Just remember that this specific usage of NXclient may have problems if certain X extensions, like compositing, are active on the server. For details, check the official documentation or this discussion.

About

Marco Fioretti is a freelance writer and teacher whose work focuses on the impact of open digital technologies on education, ethics, civil rights, and environmental issues.

6 comments
hjmangalam
hjmangalam

which uses the nomachine-abandoned v3 OSS NX libs and adds quite a bit of value in terms of ease of use and performance. Mac, Windows, and Linux clients, network sound, better security out of the box, much faster startup, etc. Have noticed some font problems on some distro's but what would we do without X11 font problems? Really a remarkable piece of work!

grassiap
grassiap

before logging the actual user an SSH connection is made with the "nx" user, using a public/private key scheme, by default the key pair is the Nomachine one. Not changing it is a security weakness to the server. the (currently) free nomachine server implementation is limited to 2 NX users. Period, not 2 at the same time: 2 ever. This a very strong way to make sure that the free version is only used for evaluation purposes. open source and free NX server alternative are Neatx (from google) and FreeNX they have a few less features. X2Go is based on the same nxproxy library that handles the magic of encrypting and optimizing the network traffic, it is however incompatible with NX.

darkduck
darkduck

What's the difference between VNC and NX? It would be nice to cover in the same article.

ict
ict

Don't You know about the X2Go project? They are very active and do have Samba, CIFS and CUPS support. http://www.x2go.org

mfioretti
mfioretti

thanks for the comments that complete nicely what I wrote (it's impossible to say everything in one blog post...). This said, the reason I know and have written about NX is that is a good solution for personal use, AND the one that, in my experience, a freelance is most likely to encounter when working temporarily in some company. In other words, if they already use NX and are set on it, knowing how to tell them to tweak it to make you work better is useful, advocating other solutions.... not really

mfioretti
mfioretti

Hi DarkDuck. Thanks for the idea, it would be a nice topic for a future post. Stay tuned!

Editor's Picks