Saturday, October 9, 2010

setting up freeNX server on Fedora-13

I have two machines, 1 running fedora-13 and other one running windows XP. I was exploring the options so that I can connect to fedora from windows and get a gnome desktop session. First option that came to my mind is setting up a vnc server on fedora and connecting to it from a vnc client running on windows.
While I was googling, I came through another option - NoMachine NX. NoMachine has a proprietary NX protocol that is supposed to be very optimized and (from the reviews I read) provides much better experience than vnc. And, I thought I will try this one.

NoMachine itself offers free nx client for windows(and for other platforms as well) and there is a free nx server implementation available. So, here is how you install both.

  • on windows machine download nx client for windows and install it, its a fairly trivial process. At the time, I got version 3.4.0-7.
  • on fedora-13 machine, do "yum install freenx-server". At the time, I got freenx-server-0.7.3-18.fc13.i686

Its easy to setup the client with information of the machine you want to connect to. BTW as nx uses ssh, make sure ssh is running on the fedora machine and that you can connect to it using a ssh client on windows machine.

Well, then I tried to connect... provided the username/password for an account that is already setup on fedora. But, it did not work. And, here is the troubleshooting process.

on windows, I used putty to connect to the fedora machine just to make sure that pure ssh connection to fedora was working fine. it was fine. Then, I looked up the "details" provided by nx client, and here is what I saw..
NX> 203 NXSSH running with pid: 4864
NX> 285 Enabling check on switch command
NX> 285 Enabling skip of SSH config files
NX> 285 Setting the preferred NX options
NX> 200 Connected to address: on port: 22
NX> 202 Authenticating user: nx
NX> 208 Using auth method: publickey
NX> 204 Authentication failed.
It looked like that my regular user was connecting fine but nx client is not being able to connect user "nx" using public key authentication. I checked on fedora machine and "nx" user was setup properly(used, "grep -i nx /etc/passwd"). Now it was a trivial affair of getting public key authentication working for user "nx". So, here is how you do it.

Create public-private dsa keys(note that current nx client can not support rsa keys), using "ssh-keygen -t dsa" and remember *not to* give a pass-phrase. On fedora machine, copy the contents of public key to ~nx/.ssh/authorized_keys2 and on windows machine, start nx client, click configure, then tab general, then button Key and copy the contents of private key to the opened window. click the save and ok buttons.(BTW, this is a very short version of setting up ssh public key authentication for a user. If you're not familiar with it already then just look for "ssh public key authentication" on google, this is not a nx client specific but regular ssh stuff)

Now, connect and voila :)

[UPDATE: Nov 05' 11] NoMachine has started giving a free edition of its server for linux and I have started using it instead of freenx-server. It can be downloaded here. All the necessary installation details are there on the mentioned page. Same are copy/pasted here.

RPM version

  • Download the RPMs
  • Change your working directory to the location where you saved the package and install it by running from a console:

    # sudo rpm -i nxclient-3.5.0-7.i386.rpm
    # sudo rpm -i nxnode-3.5.0-7.i386.rpm
    # sudo rpm -i nxserver-3.5.0-9.i386.rpm
If you don't have the sudo utility installed, log on as superuser ("root") and run the commands without sudo.
Note: The NX service can be controlled by the command /usr/NX/bin/nxserver --status|--start|--stop|--restart. Additional commands are available to configure the server. Try /usr/NX/bin/nxserver --help for more information.

Once you do the install you will still need to add your dsa public key to the NX_USER_HOME/.ssh/authorized_key2 .
On Fedora, NX_USER_HOME = /usr/NX/home/nx , Btw it can be easily found by running following command
> grep -i nx /etc/passwd

Important Note: If you have freenx-server setup already then you should remove that before installing nx{client,node,server} by running following commands.
>/sbin/service freenx-server stop
>yum remove freenx-server
>userdel -fr nx #this user was created while freenx-server installation, removing this is *critical*

No comments:

Post a Comment