January 18, 2008

NX Server for remote desktop access to Fedora 8 (update: Now on Fedora 10)

Filed under: tech — ehymel @ 9:40 am

I’ve been writing code in the wonderful Aptana Studio, including projects in Ruby on Rails. Because of the way Aptana is able to generate code on the fly during development, it’s a lot easier to develop on the target server than it is to develop on my Windows Vista laptop and transfer (or sync) the pages repeatedly. So, I thought I’d see if there was an easy way to remotely access the desktop of my Fedora box.

VNC has been around a long time, and I’ve used it for years in the Windows world, but it’s performance is not so great, and setting it up to run over ssh is not so fun.

 Searching around a bit, I found freenx, a GPL implementation of NX by NoMachine. Assuming you already have sshd running on the server, then a great set of installation instructions is here. Basically, you use yum to install 2 packages on the server, install a client program on the clients, sync the ssh keys, and you’re done. It works great!

One minor problem is that there is an updated version of the NX Server available (as of this writing, version 3.1.0-2 [update: now up to verion 3.3.0-15 as of 1/29/09]). According to the changelogs, there are a number of fixes over the version 2.1.0 installed by yum. So, I decided to see how difficult it would be to install the free version of nxserver 3.1.0 on my Fedora server. Details are below. In summary: installation was trivial, and performance is remarkably better with far fewer quirks seen in the previous version. Here’s what I did.

  1. Uninstall nx and freenx previously installed through yum.
    > yum remove nx freenx
  2. The previous install of nx/freenx created a user ‘nx’, and the ‘yum remove’ command above failed to delete that user, so I manually removed user ‘nx’.
  3. Installation of NoMachine’s NX server involves installing 3 packages that depend on each other to function. From this page, I chose the rpm packages.
  4. Once downloaded, install as usual per rpm:
    > rpm -iv nxclient-3.1.0-2.i386.rpm
    > rpm -iv nxnode-3.1.0-3.i386.rpm
    > rpm -iv nxserver-3.1.0-2.i386.rpm
  5. Now run the nxserver install script.
    > /usr/NX/scripts/setup/nxserver --install
  6. On your client machine, you should download the nx client from this page appropriate for your platform. Once installed, start the client and configure your connection (ip address, username, etc). More details about the setup, as well as troubleshooting tips, are available on the page I referenced above (here).
  7. In order to connect from the client machine, the ssh keys must match between client and server. The easiest approach is to generate the key on the server. On the server, issue this command:
    > /usr/NX/bin/nxserver --keygen
    The resulting ssh key is stored in /usr/NX/share/keys/default.id_dsa.key. Using your favorite tool, copy the contents of this file to your clipboard. Back on your client machine,  within the configuration window, click “Key” on the first tab. Paste the key from your clipboard here.
  8. Done!! You should be able to start a new session and you’re rolling!

33 Comments »

  1. I installed NXServer/FreeNX onto my Fedora 8 system and while it seems to work with minimal latency, I did notice 1 issue and wondered if you (or any of your readers) noticed this: I get most, but not all of my Fedora 8 screen downloaded to my WinXP box. What doesn’t get loaded is stuff located in the panels, specifically clock/date in the upper right, Switch window in lower left, and switch session in lower right. Also, I noticed the “Shutdown” command I loaded into the lower panel has been “grayed” out (it’s also missing from the system menu on top). Could I be missing some sort of setting to make this a complete implementation of my Fedora 8 desktop? Thanks and cheers….

    Comment by Stephj — January 23, 2008 @ 1:01 am

  2. Excellent instructions!
    After fighting with freenx for too long and installing (and uninstalling) nx* several times i chanced upon your instructions. I had to fight an uninstall which left the nx group in place. In a fit of frustration I rm -rf NX directory, which of course the uninstaller was not happy about. Finally I forced all the installs then forced all then uninstalls and subsequently followed your instructions. And it works! It pays to RTFM or at least your manual! Best Regards,
    Greg.

    Comment by greg — March 6, 2008 @ 3:37 pm

  3. I noticed the same thing with the panels as Stephj. I also tried to switch between applications by applying the CTL-ALT-K catching ALT-Tab remote switch command. On my system you can see the application switch applet come up for a millisecond, then nxclient gets switched out on the windows box to a different applications. This is rather problematic because when you minimize apps – you can no longer have access to them since they are hidden from all the panels… Can anyone think of a work-around?

    Regards,

    Greg

    Comment by greg — March 6, 2008 @ 6:56 pm

  4. Thanks man, your tutorial rocks!!!

    Hello from Guatemala

    Comment by tuxtor — March 11, 2008 @ 5:50 pm

  5. Yes I have it running as well. Recently though I made a chroot jail for my new users to utilize and I would like them to be using a nx shell instead to access the server.

    I copied some additional files over to the chroot jail and can almost connect with the client user but it fails short complaining…

    NX> 1000 NXNODE – Version
    NX> 596 Session startup failed.
    NX> 1004 Error: NX Agent exited with exit status 1.
    /usr/libexec/nx/nxserver: line 1190: 5186 Terminated sleep $AGENT_STARTUP_TIMEOUT
    NX> 105 NX> 1006 Session status: closed
    Can’t open /var/lib/nxserver/db/running/sessionId{7689C6D80F8A59151D6ED9F3667975D0}: No such file or directory.
    mv: cannot stat `/var/lib/nxserver/db/running/sessionId{7689C6D80F8A59151D6ED9F3667975D0}’: No such file or directory
    Killed by signal 15.

    Seems to be that it is not looking for the correct path to var which is now /home/jail/var/lib/nxserver/db/running
    either that or it remains a file permission problem or the way that I copied the files over from the root prompt instead of using the popular chroot script.

    Comment by albert — March 15, 2008 @ 5:06 pm

  6. Oh my now I have to no doubt rewrite my useradd script :(
    I found http://olivier.sessink.nl/jailkit/ and it has a rundown of what exactly needs to be done http://www.nomachine.com/ar/view.php?ar_id=AR09D00419

    Comment by albert — March 15, 2008 @ 5:48 pm

  7. And why isn’t Jailkit included in most distributions? Okay I’ll go RTFM

    Comment by alberta — March 15, 2008 @ 5:56 pm

  8. To greg and Stephj: I had not noticed the behavior you mention with not having the ability to switch applications. Before I was able to check it out, though, I had upgraded to the newest version of freenx. These are available from the download page and seem to be minor updates. To be complete, I downloaded the rpm versions to my server and used the upgrade option of rpm to do the upgrade:

    >rpm -Uvh nxclient-3.1.0-6.i386.rpm
    >rpm -Uvh nxnode-3.1.0-6.i386.rpm
    >rpm -Uvh nxserver-3.1.0-5.i386.rpm

    Worked like a charm. I also downloaded the client on my client windows boxes. Note that the rpm upgrade overwrote my dsa key, so I had to run “nxserver –keygen” again (I guess I could have restored my old key from backup).

    Anyway, to the original point: switching applications works fine. I use CTRL-ALT-k, then ALT-Tab switches between applications in a given console on the server. I can switch between console windows using the icons in the bottom right of the screen. I do *not* see any option to turn the machine off.

    Ernie

    Comment by ehymel — March 15, 2008 @ 7:38 pm

  9. Does anyone know how to get nxserver working in a chroot environment? I’ve posted to both the freenx list and the jailkit list. Still working on finding a solution.

    Comment by alberta — March 17, 2008 @ 9:24 am

  10. So I’ve done pretty much exactly this on a relatively fresh FC8 install. However, when I connect from NXClient on Windows the session begins and then suddenly closes. /var/log/messages shows that nxagent is segfaulting. I also had some problems with SELinux whining. Do you have SELinux disabled? Any special rules?

    Comment by Erik — March 20, 2008 @ 11:27 am

  11. Yes, I have SELinux disabled. Not sure what the issues surrounding SELinux would be since I’m unfamiliar with it.

    Comment by ehymel — March 20, 2008 @ 12:30 pm

  12. Can you tell me if you can use freenx to connect to the kdm login manager – ie connect to the remote machine before the local user there has logged in? This is something I have been doing by loading the vnc module in xorg.conf but if freenx can do this then I would like to try it – this is necessary if the remote machine is rebooted so that the user at the far end can be logged on from afar – necessary when managing a machine where the user has little knowledge even at the login level.

    Comment by Mike Cloaked — March 20, 2008 @ 4:34 pm

  13. I’m not sure I understand your question. When you “log in” using nx from a remote location, you are presented with your gnome/kde desktop, as if you had sat down at the server and logged in immediately. I don’t think it matters whether you use gnome or kde. In that case, the answer to your question is yes.

    But this may not be what you are asking. If you mean can you actually see the login console, then I don’t think you can. But then again you don’t really need to see the login dialog since that happens on the remote machine.

    This page has some great information, and specifically states that that nx supports gnome, kde, cde, and xdm.

    Comment by ehymel — March 20, 2008 @ 9:49 pm

  14. Ernie,

    Just checked to see that you responded to my (and one other’s request) concerning window data retrieved from a Fedora 8 box to a WinXP system (I’m actually Steph, but somehow a “j” got tacked on to the end of my name).

    I did eventually download the latest versions and pretty much everything seems to work. I like the response and performance of this product (having tried the various forms of VNC). One problem that I still seem to be “dogged” by is that (from my WinXP nxclient) if I open a program on the Fedora 8 box, I still do not see that window indexed on the bottom panel in the nxclient window (this works fine if I am on the Fedora box directly). Any additional insight?

    Thanks in advance…Steph (the “j” is silent :)

    Comment by Steph — March 25, 2008 @ 2:48 pm

  15. Hi – great tutorial! I know close to nothing about Linux and am trying to get nx running on my Amazon EC2 Fedora 8 install.

    I installed the packages and all seems to go well when I connect, except then I get the message that says:

    NX> 538 ERROR: User ‘root’ cannot be used as an NX user.

    Here is the full trace:
    NX> 203 NXSSH running with pid: 4672
    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: x.y.z.a on port: 22
    NX> 202 Authenticating user: nx
    NX> 208 Using auth method: publickey
    HELLO NXSERVER – Version 3.1.0-5 – LFE
    NX> 105 Hello NXCLIENT – Version 3.1.0
    NX> 134 Accepted protocol: 3.1.0
    NX> 105 Set shell_mode: shell
    NX> 105 Set auth_mode: password
    NX> 105 Login
    NX> 101 User: root
    NX> 102 Password: ***
    NX> 538 ERROR: User ‘root’ cannot be used as an NX user.
    NX> 500 ERROR: Last operation failed.
    NX> 280 Exiting on signal: 15

    Now I CAN log in using SSH as root without supplying a password because Amazon uses its own key pair for login authentication.

    At any rate I am totally stuck so would greatly appreciate any suggestions on how to get past this or troubleshoot this.

    I followed all of the steps in this tutorial to a T except I specified the latest rpm versions for install. When nx prompts me for a user name I use root. For the password I dont know what the password is because with Amazon EC2 they do not give a password, yet the client will not accept a blank password. Not sure if this is causing a problem.

    Please help!! Thanks.

    Comment by RT — March 29, 2008 @ 12:56 am

  16. Quick update: I think I have made SOME progress but am still stuck…

    I was using the key created in the default dsa instead of the client dsa.

    But now when I try it says: Authentication failed for user nx

    I am confused – what am I supposed to use for the login and password in the NX client? I don’t even know if I have a user account nx and if I do I don’t know the password.

    Really struggling here… Thanks!

    Comment by RT — March 29, 2008 @ 8:38 am

  17. Steph–

    I don’t have any insight to the problem you mentioned. I am connecting through both Vista and XP. When I open a new program (Firefox, Evolution, anything else), I get a corresponding icon in the bottom right of my screen in the respective workspace box. I’m assuming this is the problem that you mentioned is not working for you.

    Maybe someone else has an idea?

    Comment by ehymel — March 29, 2008 @ 10:04 am

  18. RT–

    I’ve never tried logging in as root. In general, that’s a terrible idea anyway. You should instead create your own user name and log in as that user. If you want to be able to do “root” kinds of actions, then run commands using sudo (run ‘man sudo’ from the command line for details).

    EH

    Comment by ehymel — March 29, 2008 @ 10:11 am

  19. Thanks EH! A few quick clarifications please:

    1) What you are saying is that the username/password specified within the NX client MUST match a real user on the Linux box right?

    2) With Amazon EC2 they do not assign a password to the root account. This is because somehow using public/private keys it KNOWS I am authenticated when I SSH into the system. For instance I connect via SSL and the OS prompts me for a user name, I type “root” and then it lets me in without prompting for a password.

    Therefore I do not know what the password for root is. I guess I could try assigning one? My main goal right now is to just log into the darn system remotely! :) The box is a bare installation – no security concerns its just a test box at the moment. I am a Linux newb so any tips on how to assign this password would be great. Hopefully I can do this and actually log in!!

    3) I understand the concern about not coming in under the root account with an NX client. However am I correct to assume that someone would have to have my DSA key in order to do this? Therefore I would think it was safe because unless they had my part of the key there is no way they can get in? I have a lot of admin type of work to do on the box so it would be most helpful to just log in as root this way.

    Thank you SO SO MUCH for the help and tips!

    Comment by RT — March 29, 2008 @ 4:21 pm

  20. Also another quick question please. I am a bit confused over which DSA key I am supposed to put into my NX client on Windows XP…

    Do I use the default.id_dsa.key or the client.id_dsa.key? Rick’s tutorial above says to generate the key and use the default one, but the client one seems more appropriate considering it needs to go into the client. Thanks!

    Comment by RT — March 29, 2008 @ 4:26 pm

  21. [...] Read more at drhymel.com [...]

    Pingback by NX Server for remote desktop access to Fedora 8 « Junji’s Blog Site — June 26, 2008 @ 7:23 pm

  22. [...] had problems installing FreeNX on a Fedora 9 server. I finaly found an article showing a sollution. I used the script below to successfully install [...]

    Pingback by Arjan’s Website » Blog Archive » Fedora 9 and FreeNX setup — July 14, 2008 @ 1:50 am

  23. Hey, RT, did you solve the problem you were facing with this on ec2 fedora machine?

    When I attempt to connect using an unix username/passwd I added on the ec2, I too get “authorization failed for user ‘username’. If I specify “root” username/passed in the client, the client reports:

    NX> 203 NXSSH running with pid: 5108
    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: 67.202.56.40 on port: 22
    NX> 202 Authenticating user: nx
    NX> 208 Using auth method: publickey
    HELLO NXSERVER – Version 3.2.0-16 – LFE
    NX> 105 Hello NXCLIENT – Version 3.2.0
    NX> 134 Accepted protocol: 3.2.0
    NX> 105 Set shell_mode: shell
    NX> 105 Set auth_mode: password
    NX> 105 Login
    NX> 101 User: root
    NX> 102 Password: *******
    NX> 538 ERROR: User ‘root’ cannot be used as an NX user.
    NX> 500 ERROR: Last operation failed.
    NX> 280 Exiting on signal: 15

    Will appreciate any help.
    Thanks!

    Comment by Nikunj — October 10, 2008 @ 4:10 am

  24. So I’m getting same problem/error as Nikunj (running FC8); EC2 only allow ssh using publickey method but nx client requires password to login…

    Can’t find anything on EC2 site or NX site…

    I’ve also try vncserver but also no luck, anyone have a working vnc solution for EC2 FC8 image? thx.

    NX> 203 NXSSH running with pid: 228
    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: 75.101.182.40 on port: 22
    NX> 202 Authenticating user: nx
    NX> 208 Using auth method: publickey
    HELLO NXSERVER – Version 3.2.0-16 – LFE
    NX> 105 Hello NXCLIENT – Version 3.2.0
    NX> 134 Accepted protocol: 3.2.0
    NX> 105 Set shell_mode: shell
    NX> 105 Set auth_mode: password
    NX> 105 Login
    NX> 101 User: root
    NX> 102 Password: *******
    NX> 538 ERROR: User ‘root’ cannot be used as an NX user.
    NX> 500 ERROR: Last operation failed.
    NX> 280 Exiting on signal: 15

    Comment by phn737 — October 22, 2008 @ 11:24 pm

  25. I can connect fine but I can’t seem to reconnect. I get this on var/log/messages when I try to reconnect

    kernel: [446980.220088] nxserver[10598]: segfault at 0000600d eip 0000600d esp bf8ff4fc error 14

    and this is the client feedabck

    NX> 203 NXSSH running with pid: 7576
    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: 64.245.185.133 on port: 22
    NX> 202 Authenticating user: nx
    NX> 208 Using auth method: publickey
    HELLO NXSERVER – Version 3.3.0-14 – LFE
    NX> 105 Hello NXCLIENT – Version 3.3.0
    NX> 134 Accepted protocol: 3.3.0
    NX> 105 Set shell_mode: shell
    NX> 105 Set auth_mode: password
    NX> 105 Login
    NX> 101 User: bueda
    NX> 102 Password: *****
    NX> 103 Welcome to: bueda user: bueda
    NX> 105 Listsession –user=”bueda” –status=”suspended54running” –geometry=”1280x800x32+render” –type=”unix-gnome”
    NX> 127 Available sessions:

    Display Type Session ID Options Depth Screen Status Session Name
    ——- —————- ——————————– ——– —– ————– ———– ——————————
    NX> 280 Exiting on signal: 15

    please help

    Comment by Vasco Pedro — January 19, 2009 @ 3:45 pm

  26. Vasco,
    Sorry, not sure what the problem is. You might try updating to the most recent version (just released last week) and see if this helps.
    EH

    Comment by ehymel — January 29, 2009 @ 9:29 pm

  27. Vasco: I have just had a similar problem and the fix for me was to uncheck the Disable encryption of all traffic checkbox under the Advanced configuration tab.

    I wish I had found this out several hours ago. I might have even got freenx working as I was having a similar problem there.

    ehymel: Thank you for your clear, concise instructions. They really helped!

    Comment by erwbgy — February 8, 2009 @ 6:48 am

  28. Thanks this really helped. I like when people can make it simple without giving to much meaningless information but just give the information you need to get it to work. Your instructions worked perfect for me.

    Thanks again…

    Comment by Benjamin Bohman — April 9, 2009 @ 4:15 pm

  29. Great!!!! Just Great!! Works like a charm!!!
    Perfect Tut!!

    Comment by cduran — April 22, 2009 @ 3:04 pm

  30. Many thanks great explanations. I have made your ınstructions but I try to connect my server givs following error message:
    Server configuration error. Cannot log in.
    Plase contact your system administrator.
    Plaese anybody can give me information?
    Regards
    Fedai

    Comment by Fedai — January 30, 2010 @ 11:13 am

  31. @Fedai:

    I had the same problem with nxserver. Just change the host name for the former (which worked OK with NX Server) and the connection came back up normally.

    []´s

    Davi

    Comment by Davi — July 1, 2010 @ 8:44 am

  32. I am having a really tough time but it’s with the freenx and with the instructions here. I keep getting the 204 error. I can login my real users with ssh password and with public / private key. I’ve made sure that the user nx is unlocked. I’ve tried the default key and generating a new key then copying that to the client.

    NX> 203 NXSSH running with pid: 9040
    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: 174.37.252.195 on port: 22
    NX> 202 Authenticating user: nx
    NX> 208 Using auth method: publickey
    NX> 204 Authentication failed.

    Any help would be great.

    Comment by Dade — August 6, 2011 @ 4:50 am

  33. Thank you very much. Your instructions great.

    Comment by sridhar — June 14, 2012 @ 10:55 am

RSS feed for comments on this post. | TrackBack URI

Leave a comment

XHTML ( You can use these tags): <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .