How to access NX Server from command line in Windows?

3k views Asked by At

I want to access NX server using a client device which has Windows through command line using components like nxssh, nxWin, nxproxy. Not through the GUI of the NX Client.

In other words, I want the opposite command in Windows of the commands like 'nxproxy -S ...' that's used in Linux.

1

There are 1 answers

0
Raimund Steger On

nxproxy doesn't seem to be supplied for the Windows client. However, you can compile it with Cygwin tools from nxcomp-3.4.0-7.tar.gz and nxproxy-3.4.0-2.tar.gz. You might need the following Cygwin packages:

  • libpng12-devel
  • zlib-devel
  • libjpeg-devel
  • libX11-devel
  • gcc4-core
  • gcc4-g++
  • make
  • autoconf2.1

Unpack the NX tarballs in one common directory, so that it contains the subdirectories nxcomp/ and nxproxy/ afterwards.

To build nxcomp-3.4.0-7:

echo '
388c388,389
<     LIBS="-lstdc++ -lpng -ljpeg -lz"
---
>     CXXFLAGS="-I/usr/include/libpng12 $CXXFLAGS"
>     LIBS="-lstdc++ -lpng12 -ljpeg -lz"
' | patch configure.in
autoconf-2.13
./configure
make

To build nxproxy-3.4.0-2:

echo '
162c162
<     LIBS="$LIBS -L../nxcomp -lXcomp -lstdc++ -Wl,-e,_mainCRTStartup -ljpeg -lpng -lz"
---
>     LIBS="$LIBS -L../nxcomp -lXcomp -lstdc++ -Wl,-e,_mainCRTStartup -ljpeg -lpng12 -lz"
' | patch configure.in
autoconf-2.13
./configure
make

Afterwards put cygXcomp.dll and nxproxy.exe in any directory of your choice, it should run from there.

Note: nxcomp includes code that makes it use nxauth instead of xauth when building for Windows. If that's not what you want, because you want to use Cygwin's xauth, remove the appropriate part from Auth.cpp. But nxauth should work just fine if you set the NX_SYSTEM environment variable to your NX client's installation directory.

NXWin is included with the client installation. It can be a bit picky about its invocation. A line that works for me is:

nxwin -fullscreen -fp <YOUR_FONT_PATH> -hide -clipboard -noloadxkb -nokeyhook -auth <YOUR_XAUTHORITY_FILE> -nowinkill -name NX :1 

You can supply "-screen 0 1280x1024" etc. instead of "-fullscreen" to get a window.

Path arguments to nxwin.exe should be in POSIX format ("/cygdrive/c/..."). To find out about your font path setting, you could try running NXWin through nxservice.exe which will result in informative log output on the console, e. g.

nxservice --start display --nokeyhook --resolution fullscreen

In addition to NX_SYSTEM, it is necessary to set the NX_ROOT and XAUTHORITY environment variables before running nxservice. NX_ROOT is your .nx directory. XAUTHORITY points to the Xauthority file, which could be %USERPROFILE%\.Xauthority.