nxsession uses NX 3 and bash scripts to start and manage persistent X sessions. Think of it as screen or tmux for X.
It is better than ssh -X
because:
- The NX session is not killed if the network disconnects.
- It is more responsive as it reduces number of round-trips between the client and server.
It is better than VNC because:
- It has much lower bandwidth requirement.
- It plays well with multi-monitor setups.
The code is just one bash script each for the viewer and host - nxviewer and nxhost that call NX 3 binaries nxproxy and nxagent respectively. At present, it has been tested on Linux host and Linux/Mac OS X viewer setups. A Windows viewer might be possible using nxlogin.
Say you have two machines work
and home
. You are at home
and want to run programs on work
:
home> nxviewer work:3
# this starts an NX session on work with windows on home.
# by default, it opens xterm from which you launch other programs.
# once you are done, suspend the session with:
home> nxviewer suspend :3
# at work, you can get back the windows with:
work> nxviewer :3
Or, if you are at work
and intend to continue on home
later:
work> nxviewer :3
# this starts and displays an NX session on work.
# at home, you can move all windows from work with:
home> nxviewer work:3 -f
x2go maintains compiled binaries for all NX 3 libraries. For example, rpm's for RHEL are here. Download rpm’s for the appropriate version of RHEL.
- libNX_X11-6
- libNX_Xcomposite1
- libNX_Xdamage1
- libNX_Xdmcp6
- libNX_Xext6
- libNX_Xfixes3
- libNX_Xinerama1
- libNX_Xpm4
- libNX_Xrandr2
- libNX_Xrender1
- libNX_Xtst6
- libXcomp3
- libXcompext3
- libXcompshad3
- nxagent
- nxproxy
The viewer needs only nxproxy and libXcomp3, while the host needs all the packages except nxproxy. For a complete host+viewer setup, simply get all packages.
Extract the rpm into a folder:
mkdir nx
cd nx
for rpm in <downloads>/*.rpm; do
rpm2cpio $rpm | cpio -idmv
done
You should get folders inside nx/
as follows:
etc -> unused
usr ->
bin -> wrappers for executables
lib64 -> libraries
nx ->
bin -> actual executables
share -> man pages, docs, etc.
We will remove the wrappers and move the actual executables in their place. The wrappers are probably needed for a full-fledged nxclient-nxserver setup or for x2go. Also, add rpath to the executables so that they can find their libraries. Finally, copy nxviewer and nxhost scripts into the bin folder.
cd usr/bin
mv ../lib64/nx/bin/* .
rm -r ../lib64/nx
patchelf --set-rpath '$ORIGIN/../lib64' nxagent
patchelf --set-rpath '$ORIGIN/../lib64' nxproxy
cp <path to repo>/nxviewer .
cp <path to repo>/nxhost .
Before using nxviewer, add the bin folder to PATH. On the host, make sure the login shell adds the bin folder to PATH by editing the appropriate rc file (~/.bashrc, ~/.profile, ~/.tcshrc). Test your host installation by running ssh <host> -t nxhost
from the viewer. It should print nxhost's help message.
Download the X2Go Client dmg from here and copy nxviewer into the same folder as the nxproxy executable and add the folder to PATH. We have tried to use only common UNIX commands that should be installed on OS X by default. If that is not the case, please open an issue.
- A new session executes
~/.nx/xstartup
if available. Else, it will tryxterm
. - If you closed your terminal and cannot open any new programs in the session, ssh to the remote machine and run
env DISPLAY=:<display> xterm &
. - If you left the session connected to one machine and want to access it on another, add
-f
to force the first machine to disconnect. - Run
nxviewer -h
to see all available commands and options.