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.
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.