I'm using official NX Server (not FreeNX) on a Gentoo Linux server. It normally runs as its own user and is not in the path. In order to make it work with this script I simply had to edit the "nxagent" line in the script to call it explicitly like: LD_LIBRARY_PATH=/usr/NX/lib /usr/NX/bin/nxagent After that, it works. Thanks a lot for this.