NoMachine’s NX client is a great tool for running desktop applications on a remote machine. You can either attach to the remote machine’s desktop session (session shadowing) or start an independent NX session solely for remote usage.
As session shadowing unlocks a potentially running screensaver, it is only suited for accessing PCs in locked offices or at home. In an open office environment, only an independen NX session makes sense. This, however, has a drawback as well. Many desktop applications like Firefox or OpenOffice do not easily permit running multiple instances concurrently. Thus you have to close these programs before starting them in the other session (local desktop session or remote NX session). This gets quite annoying.
For people working in an open office environment, a combined solution is needed, that uses the same session locally and remotely, while not opening it to passersby. This means all programs are running inside an NX session and the user starts nxclient even when locally logging in to the machine. The rest of this blog post will deal with the peculiarities of this local setup.
Nxclient has two technical drawbacks preventing it from running stand-alone:
- At least in my setup (Ubuntu 9.10 with GDM), it doesn’t grab keyboard focus.
- Nxclient forks nxssh for the actual session handling and ends itself, thus closing the local desktop session.
To work around the first issue, a window manager is needed. This should be as minimal and lightweight as possible so as not to interfere with whatever is running inside the NX session (think keyboard shortcuts or mouse gestures). I chose fvwm2 with a minimal configuration, stripping it of virtually all its functionality. I even chose to not lock the screen from fvwm2 but instead lock the session from within NX. This way NX users and regular users, with only a local desktop session, share the same screensaver configuration.
A natural workaround for the second issue would be to start fvwm2 after nxclient and keeping it in the foreground. This way, a user would have to explicitly exit fvwm2 to logout. To make the window manager as transparent as possible, it would be much nicer, to terminate the session once nxssh is terminated. This can be accomplished with fvwm2 running in the background and a loop, waiting for nxssh to finish.
Putting it all together, this is how to setup an nxclient-only session with GDM on Ubuntu 9.10:
1 2 3
- login with GDM, choosing NX Client as session (you might have to restart gdm first)
- configure nxclient for fullscreen mode
- use CTRL-ALT-T to disconnect from the NX session, terminating nxclient