SDB:FreeNX server

Jump to: navigation, search


About

NX is a remote access protocol. It is both fast, secure, graphical and open (as opposed to the Telnet protocol, which is only fast and open).

NX is basically a client-server protocol, that allows you to graphically access any machine, It is based on both SSH (for security) and X Compression (for GUI and speed), and NX is much easier to use than normal X protocol.

This How-To describes how to use SUSE Linux 10.0 as a Terminal Server, how to configure stuff, and how to connect to it.


Short history

After NoMachine created NX a few years ago, they released their core libs and commandline tools to the public (as GPL). Kurt Pfeifle - a KDE contributor - took those libs and tools and created a first humble (unreleased) script that automated the setting up of a remote NX connection to a degree. After Kurt introduced Fabian Franz (at the time a contributor to Knoppix and MPlayer) to NX, Fabian created a project called FreeNX; FreeNX is a work-alike implementation of NoMachine's commercial (and closed source) NX Server.

NoMachine still releases their core libraries under GPL, gives away their NX Client and grants free binary redistribution rights for it. Their client can be used to access FreeNX servers.

We - the community - can use the GPL'ed implementation of the FreeNX server and the KDE "knx" client (though that one does still miss many features and lacks maintenance).

There's also the GPL-ed client for the 2X server (another commercial product by a different company that uses the NX core libs) that is supposed to work with FreeNX.


Setting up things

openSUSE 11.3

There's a known bug (Bugzilla #615164). Due to a change in SSL. After the installation like described for 11.1 and 11.2 the following line must be added to /etc/nxserver/node.conf:

COMMAND_MD5SUM="md5sum"


On 64bit systems you may run into this:

Setting up cups nxipp backend ...cp: cannot stat `/usr/lib64/cups/backend/ipp': No such file or directory

Simply create the missing directory

$ mkdir /usr/lib64/cups/backend/ipp

and rerun the install


A problem which regularly occurs is that you have to try to make the connection a number of times before it succeeds. You can solve that by introducing a "sleep 4" in the script /usr/bin/nxnode

 # Patch - delay to allow nxagent to complete launching. ccb 20100407
 sleep 4
 
 echo "Xft.dpi: 96" | DISPLAY=:$display xrdb -merge >>"$USER_FAKE_HOME/.nx/C-$sess_id/session" 2>&1

Insert the first 3 lines in the above textblock just before the last line in that block.


Another problem is that the arrow keys do not work or have an unexpected action. The solution is to add the text

 ${client:+client=$client,}

in a line which contains:

${kbtype:+kbtype=$kbtype,}${kbload:+kbload=$kbload,}${keymap:+keymap=$keymap,}

insert the text with client above right after the text above. The line above is only part of whole line.


There is also a report that after installation the owner of the file /var/lib/nxserver needs to be changed by giving the command:

chown nx /var/lib/nxserver


Another report is about the creation of the user nx, which is created as a disabled account which prevents it from giving access via public key authentication. The reported solution is to give the account a password using the command:

passwd nx

after that you will be prompted for a password which can be anything, however you have to type it twice.

SSH User Group

Error when running nxsetup --install --setup-nomachine-key --clean

If you have create a special group (say ssh_group_user) for ssh user ( following some forums recommendation ) and have configured /etc/ssh/sshd_config for these users by adding :

AllowGroups ssh_group_user

You have to either do modification (a) or (b)

a)

  1. Remove group ssh_group_user ( as in my example )
  2. Change AllowGroups to --> AllowGroups utmp
  3. Add group utmp for all your ssh user

or

b)

Edit /var/bin/nxsetup. Near line 274 and change search for :

echo -n "Adding user \"nx\" to group \"utmp\" ..."

usermod -G utmp nx


And Replace utmp by the name of your ssh user group (ssh_group_user as in my example) .


echo -n "Adding user \"nx\" to group \"ssh_group_user\" ..."

usermod -G ssh_group_user nx

openSUSE 11.1 and 11.2

The FreeNX package is no longer present in the official openSUSE 11.2 repositories. However the packages are available in the Build Service.

  • Install NX and FreeNX rpms from here and here. The versions from the repository X11:RemoteDesktop/openSUSE_11.2 should work fine.

Replace 11.2 with 11.1 with the version of openSUSE you are running.

 zypper ar http://download.opensuse.org/repositories/X11:/RemoteDesktop/openSUSE_11.2 RemoteDesktop
 zypper ref
 zypper in FreeNX NX
    • As pre-requisite before installing the rpm above, you may need to install packages like expect and rdesktop. Install using YaST's Software Management or zypper on command line.
  • Run nxsetup --install --setup-nomachine-key to install the server the first time
  • Use nxserver --status to check status of the server. The server runs on the ssh port, 22.
  • Test connecting using any NX client. Official No Machine client can be downloaded from www.nomachine.com which installs the client binary at /usr/NX/bin/nxclient See http://walter.deback.net/blog/archives/19 for using the NX client effectively.

openSUSE 10.0

If you are, like me, running SUSE Linux 10.0 - you will need to install FreeNX package (the server) using YaST (freenx is on SUSE CDs/DVD) as well as some client software (to test on local machine) - you can use freeware NX Client (from www.nomachine.com/download) or use Open-Source "knx" - the standard KDE NX Client.

After setting up the procedure is damn easy.
First enter root mode, then:

1) let's make sure that you installed the right package:

linux:/ # rpm -q FreeNX

FreeNX-0.4.4-4  ; for openSUSE 11.1 this is: FreeNX-0.7.3-1.1

If it returs nothing, then install it using YaST. If returns "FreeNX-0.4.4-4" like in my case, then all is OK.

2) This will configure the FreeNX server: (using the standard key)

linux:/ # nxsetup --install --setup-nomachine-key --clean

At least in openSUSE 11.1 you will see some checks done. Some will fail but may be harmless unless you want these features working. At the end a test session will be done which should succeed. You may want to save the output of nxsetup in a text file for later reference.

3) start any NX client - I use NoMachine's - and type: localhost as my host, 22 as my SSH port - after all NX is based on SSH, my user's name & password, desktop: UNIX/KDE set the resolution press ok - and - everything works wonderfully !

NX-In-Action Screenshot:

NX-In-Action.png

Congratulations ! ! ! You are done !

The next paragraphs are strictly optional for Advanced NX configuration. You don't need to read them to make NX working.


Running the terminal server

In the real world, running a Terminal Server requires more than just configuring NX Server - it also requires to configure users on the server. On SUSE Linux it's easiest to do with Yast. Now we need to configure the clients - there are two ways for achieving this:

1) Using existing (Windows ?) Workstations and simply install NX Clients on them.

2) Use LiveCD that comes with NX Client. Newer Knoppixes do. v3.9+.

NOTE1: Unfortunately, the SUSE Live DVD do not meet the specs - it doesn't include NX Client _and_ doesn't include UnionFS to install the NX Client. SUSE Live DVD can still be used - but you will have to manually install the NX client with user account but it's harder than Knoppix.

NOTE2: FreeNX as a Terminal Server is great, because it's very fast, secure, and the software is not the limited to the number of clients -- your only limitation is the power of your Server. (that is -- the performance of your CPU & amount of RAM)

3) Use discless distributive, such as thinstation or 2x.com.


A note about NX clients

There are two NX clients in existence - namely:

a) the freeware NoMachine's "NX client" (closed-source). Advanced client.

b) and an open-source KDE "knx" client. Simple Client.

Each is supported on different platforms:

1) Windows 95...XP - must use a.

2) Mac OS X (ppc) - must use a.

3) Linux - can use a -or- b.

4) FreeBSD - must use b.

5) Solaris (sparc) - must use a.

A Server can be Linux or UNIX host only.
SUSE Linux 10.0 is very well supported. Another UNIXes/Linuxes might need to compile stuff.


Using KDE3 if KDE4 is installed

If KDE4 is installed on the NX server and you attempt to login to a KDE desktop, the NX server will default to a KDE4 desktop.

If you wish to connect to a KDE3 desktop remotely, add the following line to the /etc/nxserver/node.conf file:

COMMAND_START_KDE=startkde3

On openSUSE 11.0, startkde starts KDE4 and startkde3 starts KDE3.


Changing NX TCP port

Because changing NX port on the client is straightforward - I will concentrate on the server here.

Since FreeNX server is based on SSH, changing NX port will require you to change SSH port as well, or NX will fail. The default TCP port of SSH and NX is 22. The configuration files on SUSE Linux 10.0 are:

/etc/nxserver/node.conf

/etc/ssh/sshd_config

...and don't forget to restart the SSH service afterwards.

Tip for advanced users:

By using this technique - you can effectively setup a farm of Linux distros even on your home PC - using some kind of virtualization (VMware/Qemu/Xen) - by setting up virtual NX servers to listen on different ports. This is really cool - because it can be used from both a LAN and from the Internet at the same time !


Runlevels

The NX Server can run in runlevel 3 or 5. NX Server doesn't use video card, so it will work.

NX Client will require you to use runlevel 5. (*Applicable only if you run NX client on SUSE Linux - since Windows has no runlevels concept)

To find out in which runlevel you are working now, use:

> who -r

       run-level 5  2006-04-24 17:33                   last=S

International keyboard support

The NX Server requires a small modification of /etc/nxserver/node.conf as root to allow NX clients to use other keyboards settings than the US (QWERTY) one:

Locate the line in /etc/nxserver/node.conf reading:

       #AGENT_EXTRA_OPTIONS_X=""

And change it to read:

       AGENT_EXTRA_OPTIONS_X="-xkbdir /usr/share/X11/xkb"

Restart your NX Server with:

       nxserver --restart

Then reconnect your NX Client and that's it. You should now have a working international keyboard.


SLE 10 modifications

These instructions work on SLED10 SP2 and SLES10 SP2, with the following additional setup steps:

  • FreeNX, NX, rdesktop do not ship with SLE 10, so you must download an RPM from the OBS Project.
  • FreeNX has dependencies on the following packages that can be installed from the shipping CD/DVD/ISO
    • expect
    • NX
  • After running nxsetup, the following line must be un-commented and modified as follows in /etc/nxserver/node.conf
COMMAND_SESSREG="/usr/X11R6/bin/sessreg"
  • This prevents the following error when trying to connect a client:
/usr/bin/nxserver: line 874: sessreg: command not found
NX> 280 Exiting on signal: 15

SLE 11 modifications

These instructions work on SLED11 (should also work on SLES11, but untested), with the following additional setup steps:

  • FreeNX has dependencies on the following packages that can be installed from the shipping CD/DVD/ISO
    • expect
  • FreeNX, NX, rdesktop do not ship with SLE 11, so you can install via the OBS Project Repository: openSUSE11.1 RemoteDesktop Repo
  • After running nxsetup, the following line must be un-commented and modified as follows in /etc/nxserver/node.conf (note path difference from SLE10)
COMMAND_SESSREG="/usr/bin/sessreg"
  • This prevents the following error when trying to connect a client:
/usr/bin/nxserver: line 874: sessreg: command not found
NX> 280 Exiting on signal: 15

See also

Related articles

External links