Wednesday 29 April 2009

Connect Remotely to Your Linux Machine Graphically

Free NX is a client/server application which allows you to login remotely from another PC into your Linux system. The client is available for both Linux and Windows, so you will be able to login from a Windows machine too.

NX client connected to a Debian KDE3 session, 1024x768

In order to set up Free NX, you only need to install three DEB packages, start a SSH server and you're ready to go. In Debian Lenny and Ubuntu, just follow the steps below:

First of all, install the SSH (secure shell) server:

apt-get install openssh-server

SSH listens by default on port 22. You can test your SSH server by trying to login to localhost:

ssh your_username@localhost

And use your user's password. If the login is successful, you can proceed to the next step. In order to logout, just type Ctrl+D.

Next, download the Free NX DEB packages from the NoMachine website, here. The files which you need to download are called:

nxclient_3.3.0-6_i386.deb
nxnode_3.3.0-17_i386.deb
nxserver_3.3.0-22_i386.deb

Next, you will need to install all three of them, so type as root:

dpkg -i nxclient_3.3.0-6_i386.deb
dpkg -i nxnode_3.3.0-17_i386.deb
dpkg -i nxserver_3.3.0-22_i386.deb

What you need to do next is to start the NX server (if it isn't already started). To do that, type as root:

/etc/init.d/nxserver start

The output should be something like this:

# /etc/init.d/nxserver start
NX> 122 Service started.
NX> 999 Bye.
NX> 723 Cannot start NX statistics:
NX> 709 NX statistics are disabled for this server.
NX> 999 Bye.

Now, in order to test if what we've done is working, try to connect using the NX client to your own machine, so run as normal user:

/usr/NX/bin/nxclient

Notice that the path to nxclient is non-standard, so nxclient will not be included in your path; you have to use the full path to it. See the screenshots below of NX client in action:

Enter your username and password from your Linux machine

Configure NX client - I used localhost host here, but from another machine you'll have to enter the IP of the remote machine

An alternative NX client is qtnx (apt-get install qtnx) but I had some stability issues with it when trying to connect to a machine which doesn't has NX server configured.

QtNX, another NX client

The good thing about Free NX is that clients are provided for both Linux and Windows, so you will be able to login into your Linux machine from Windows without any problems.

12 comments:

Ivan Privaci said...

It's important to note that the "NX Free Edition" server that NoMachine offers for download is NOT "FreeNX". The former is actually a limited version of NX's commercial software, and only allows two login names total, and only two sessions at a time. FreeNX[1] is a separate project running all GPL versions of the same system.

Having tried both, I can say they both work amazingly well, but I find the proprietary one's restrictions obnoxious.

Also, NX has clients for Mac OSX as well as Linux and Windows.
[1] http://freenx.berlios.de/

Frank said...

Great article, I would like to point out that you can do this with xrdp, which will allow you to connect to a linux box with the built windows rdp client. If you are connecting from a linux box your can use rdesktop to connect to another linux box running xrdp.

http://xrdp.sourceforge.net/

Anonymous said...

I use NX regularly for remote GUI access to Linux, and really love it. One thing I would mention is that you are not limited to accessing the desktop via NX, but you can also constrain it to individual applications - which has very interesting implications for SAAS.

Anonymous said...

KDE gives you this ability and is easy to setup. KRDC is the package to install if it isn't already and you configure it via the "control center". Use any VNC client you like to connect to the machine.

Jacques Merde said...

What advantages does this offer over remote X via XDMCP? MS Windows access an be accomplished via cygwin X and OSX can use the Apple supplied X server.

Remote network access has been built into X since 1985, so I fail to understand all the hoopla about these new clients. But I'm willing to be enlightened.

Cheers,


Jacques

Anonymous said...

Jacques: Bandwidth and latency. Try running raw X over a connection less than 50 mbit/sec wide and with a latency higher than 10 msecs.

Anonymous said...

The real advantage is in the NX compression which makes it highly responsive over all connections that I've tried so far and it's tunneled over SSH by default for security. In my experience, it provides a desktop that is more responsive than any other remote graphical console I've every used and easier since I don't have to setup an SSH tunnel on my own.

Ant said...

Isn't this like VNC?

Ivan Privaci said...

It's "like" VNC (and rdc) in that it accomplishes a similar thing - in fact one of the less-noticed features of NX is that you can actually TUNNEL VNC and rdc through the NX server (which acts as a proxy), getting much of the compression benefits of NX even for VNC and RDC. (Yes, I've tried them both and they DO perform substantially better than, for example, just tunnelling VNC over SSH directly).

The compression makes NX extremely responsive even over very slow links. The other posters aren't kidding about being able to use this over dial-up.

Anonymous said...

While I like the possibilities that NX gives you, I don't like the closed-source approach. Sure, they publish an open-source client, but this client seems to always be a bit behind (version 0.7.x for the open-source-version vs. version 3.3.x for the closed-soure - but free - one).

An interesting project I've come across is x2go (http://www.x2go.org). It is completely open source and, though originally targeted at classroom environments, works pretty well in commercial environments. We use it in our company since months without hickkups.
It also has some nice features like LDAP-connectivity and support for mobile clients. It might be worth taking a look.

Anonymous said...

While I like the possibilities that NX gives you, I don't like the closed-source approach. Sure, they publish an open-source client, but this client seems to always be a bit behind (version 0.7.x for the open-source-version vs. version 3.3.x for the closed-soure - but free - one).

An interesting project I've come across is x2go (http://www.x2go.org). It is completely open source and, though originally targeted at classroom environments, works pretty well in commercial environments. We use it in our company since months without hickkups.
It also has some nice features like LDAP-connectivity and support for mobile clients. It might be worth taking a look.

Bret said...

I installed and am running x2Go on a windows box on my LAN to my linux (ubuntu) server and the speed is rediculously slow. I have been waiting for MLB.com to come up for 2 minutes. And to just pull up a firefox menu such as View gives a 5 second delay. The server it is accessing is not a bad server at all either.

I hear all about how fast this is supposed to be - and I would love for that to be the case, but can anyone suggest how I cod make it so?

Thanks,

Bret