Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32

Thread: NoMachine NX: simple setup without adding users

  1. #1
    Join Date
    Jul 2005
    Location
    /dev/UK
    Beans
    984
    Distro
    Ubuntu Mate 18.10 Cosmic Cuttlefish

    NoMachine NX: simple setup without adding users

    After struggling with VNC for some years I finally tried out Nomachine's NX server instead. Overall it's much faster than VNC and very simple to set up. However, searching this forum and google turned up lots of conflicting instructions about how to configure things. So in the end I just waded through Nomachine's online documentation and help system. What I wanted was for the connection to a remote machine to be as secure as possible, and more usable than VNC through an ssh tunnel, without having to jump through too many configuration hoops. I'm posting what I did here in case someone else wants to give NX a try. I know there are other how tos on the forum, but most seem to include a step about adding users. This isn't strictly necessary, and so I haven't included it.

    Just for information, both the server and client software were installed on Hardy, and I've used the latest version of the Nomachine packages and not the FreeNX packages. I believe FreeNX is very similar, but having never tried it I don't know if these instructions will work with that as well. So here goes:

    1. Make sure openssh-server is installed on the server machine/s and that you can ssh into into those machines. See this link. Just one caveat. You must ensure that password based authentication is enabled in the /etc/ssh/sshd_config file of the server machine. Initially you should also use the standard port 22 for ssh as well.

    2. Download these files from here

    nxclient_3.2.0-14_i386.deb
    nxnode_3.2.0-13_i386.deb
    nxserver_3.2.0-16_i386.deb

    3. Put the files in the home directory of the machine you want to use as the server, open a terminal, and install them:

    Code:
    sudo dpkg -i *.deb
    note: make sure that these are the only .deb packages in your home directory when you do this.

    4. Repeat the above on the client machine - on the client you only need the nxclient package and not the nxserver and nxnode packages

    5. At this stage it's worth testing that everything works 'as is'. You may have to do a 'killall gnome-panel' before the NX entry appears in the menu, but once it has you'll find it under applications/internet. Open the NX connection wizard and follow along. You should be able to log in as a normal user with the user name and password that you normally log into the system with. If all goes well a session should open on your desktop displaying the server machine's desktop.

    6. If all went well you will now want to change the default ssh keys that the NX server uses. When you first install the nx packages they ship with default keys that are the same for everyone. Potentially this means that anyone with the nxclient package installed could authenticate against your server. Not good! However, changing these keys is simple. Just log into the server (or ssh to the server) and do the following:

    Code:
    sudo su
    /usr/NX/scripts/setup/nxserver --keygen
    chown nx:root /usr/NX/home/nx/.ssh/authorized_keys2
    chmod 0644 /usr/NX/home/nx/.ssh/authorized_keys2
    chown nx:root /usr/NX/home/nx/.ssh/default.id_dsa.pub
    chmod 0644 /usr/NX/home/nx/.ssh/default.id_dsa.pub
    Then copy the default.id_dsa.pub file to the client. I did this using scp from the client machine, e.g.
    Code:
    scp user@server:/usr/NX/share/keys/default.id_dsa.key .
    But you could just as easily copy it to a usb flash drive and transfer it to the client. Once you've saved it to the client machine's home directory you should rename the key from default (I use my user name) and copy it to the /usr/NX/share/keys/ directory:

    Code:
    sudo cp default.id_dsa.key /usr/NX/share/keys/user.id_dsa.key
    Now test that you can connect to the nx user account on the server with this key:
    Code:
    ssh -i /usr/NX/share/keys/user.id_dsa.key nx@server
    You shouldn't be prompted for a password. If you can connect as the nx user just type quit to exit. Then launch the nx client from the menu, hit configure, and then the key button on the general tab. Delete the exiting key and press the import button. Import the key that you've just saved in the /usr/NX/share/keys directory. Save everything and then try connecting with the client.

    Optional steps

    7. If all went well you can now change the default ssh port to a non-standard one (say 2222 for this example). Go back to the server machine (or shh to it) and edit three files to make the changes.

    First edit the /usr/NX/etc/server.cfg file:
    Code:
    sudo gedit /usr/NX/etc/server.cfg
    Look for these entries:

    #SSHDPort = "22"
    #SSHDAuthPort = "22"

    Uncomment and change 22 to 2222. Save and close.

    Then edit /usr/NX/etc/node.cfg:
    Code:
    sudo gedit /usr/NX/etc/node.cfg
    Look for this entry:

    #SSHDPort = "22"

    And again uncomment and change the port number. Save and close.

    Finally edit /etc/ssh/sshd_config

    Code:
    sudo gedit /etc/ssh/sshd_config
    Look for this entry:

    Port 22

    And again change the port, save and close.

    Finally, restart ssh:
    Code:
    sudo /etc/init.d/ssh restart
    On the client machine you should then launch the nx client, press the configure button, and enter the new port in the general tab.

    That's it. You should now be able to connect to the nxserver on a non-standard port with a custom ssh key.

    8. For added security you might also want to go back to the server machine and edit the /usr/NX/etc/server.cfg file again. Find this line:

    #EnableUnencryptedSession = "1"

    Uncomment it and change the "1" to a "0"

    This will force nx to use ssl encryption at all times.

    That's basically it. The only problem I have with nx so far is not being able to disable password based authentication in my sshd_config. There is a work around which involves adding system users to the nx server and then using the nx database rather than ssh to authenticate. However, I haven't tried this, so I'm not able to comment on how well it works, What I've done instead is limit the number of users who can ssh into the server machine (nx must be a listed user), and restricted access in my firewall to only allow certain machines through.

    Hope this helps someone.

  2. #2
    Join Date
    Aug 2008
    Beans
    3

    Re: NoMachine NX: simple setup without adding users

    Hi,
    Thanks for posting directions on setting up NoMachine NX. Installation on a system running Ubuntu 8.1 seemed to proceed fine:
    /usr/bin/NX/nxserver --status gives

    NX> 900 Connecting to server ...
    NX> 110 NX Server is running.
    NX> 999 Bye.

    I imported the default.id_dsa.key into the NX client on the remote machine. When I try to log in, I get:
    Public Key authentication failed

    and in details:

    NX> 502 ERROR: Public key authentication failed
    NX> 502 ERROR: NX server was unable to login as user: recif
    NX> 502 ERROR: Please check that the account is enabled to login,
    NX> 502 ERROR: the user's home directory, the directory ~/.ssh
    NX> 502 ERROR: and the file ~/.ssh/authorized_keys2 have correct
    NX> 502 ERROR: permissions setting according to the StrictModes
    NX> 502 ERROR: of your SSHD configuration.
    NX> 999 Bye.
    NX> 280 Exiting on signal: 15

    I checked that group and other do not have write access the directory ~/.ssh and the file ~/.ssh/authorized_keys2 for recif on the server running NX.


    Any help to fix this is appreciated.
    Recif

  3. #3
    Join Date
    Jul 2005
    Location
    /dev/UK
    Beans
    984
    Distro
    Ubuntu Mate 18.10 Cosmic Cuttlefish

    Re: NoMachine NX: simple setup without adding users

    Sorry for the delay in replying. I'm working away from home all week at the moment so I'm only back at weekends.

    For some reason the ssh keys clearly don't match. Can you log in to the server as the nx user using the key you generated:

    ssh -i /usr/NX/share/keys/user.id_dsa.key nx@server

    Obviously change the name of your key in the above command to whatever you renamed it to, and make sure it's location is correct.

    If that fails try generating a new set of keys and try again. I've now followed this method on 5 different machines and had no problems, although I'm using Hardy not 8.10

  4. #4
    Join Date
    Apr 2008
    Location
    Fairbanks, AK USA
    Beans
    133
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: NoMachine NX: simple setup without adding users

    I'll probably be giving this a try! Thank you!

  5. #5
    Join Date
    Nov 2008
    Beans
    4

    Re: NoMachine NX: simple setup without adding users

    Hi,

    The question is how do you run a NX Client Session so that it is the only X11 session on the server? I'm not sure if I phrased this correctly so bear with me, because I am a Linux newbie.

    I've tried to use Nomachine NX server as a solution to running a headless Ubuntu box (Intrepid). I've gotten the setup to work, but I havent bothered yet to change the keys or ports. The bottom line is that it is a very nice solution. The performance is amazing for an RDP application, much faster than VNC... so long as you run it from the client and "spawn" a new X11 session (sorry if my terminology is incorrect here) at the server. From the General tab of the NX client configuration screen you select Unix + GNOME (or KDE) in the Desktop configuration box. The alternative is to run it as a Shadow session, but then the performance is about the same as VNC.

    The downside of starting a new GNOME session is that it eats up memory in your server box, because you essentially have 2 GNOME sessions operating on your machine at the same time. I also happen to have VNC server installed on the box, and I can VNC into the "original session" while controlling a 2nd NX Session. When you pull up system monitor, you have 2 copies of a host of processes running... I guess because you have 2 simultaneous GNOME sessions running at the same time. There are other downsides as well. I havent figured out how you run firefox in 2 different sessions. You get the error "Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process...". The final downside is that you cant shutdown your server from the 2nd session. If you issue a shutdown command, it shuts down the session, but does not shut down the server. On the other hand, if you shutdown from the original VNC session, it seems to shutdown the machine.

    So, I hope this explains my problem but does anyone know if it is possible to run NX Client as the first (or primary, if there is such a thing) X11 session?

  6. #6
    Join Date
    May 2007
    Beans
    13
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: NoMachine NX: simple setup without adding users

    Quote Originally Posted by sandbox4us View Post

    So, I hope this explains my problem but does anyone know if it is possible to run NX Client as the first (or primary, if there is such a thing) X11 session?
    I am looking for the same solution.
    any one "expert" want to have look into this please?

  7. #7
    Join Date
    Jul 2005
    Location
    /dev/UK
    Beans
    984
    Distro
    Ubuntu Mate 18.10 Cosmic Cuttlefish

    Re: NoMachine NX: simple setup without adding users

    If anyone does know a way to do this please let us know. However, as far as I'm aware I don't think it is possible.

  8. #8
    Join Date
    Dec 2008
    Beans
    10

    Re: NoMachine NX: simple setup without adding users

    Hello!

    I have followed the how to, however am unable to connect. I'm trying to connect to Ubuntu 8.10 - Intrepid Ibex from Windows XP.

    The installation seemed to go smoothly on both, but if I try to connect, I get the following error:
    "Authentication failed for user (username)".

    I can log in to the server via ssh as an nx user.
    Also, I ran
    nxserver --usercheck <username>
    and the output indicated that everything is ok.

    Does anybody have any ideas what could be wrong?

    Thanks in advance
    Last edited by AlesZib; February 12th, 2009 at 09:39 PM. Reason: Correction of an error - I run nxserver --usercheck <username>, not --useradd

  9. #9
    Join Date
    Jul 2005
    Location
    /dev/UK
    Beans
    984
    Distro
    Ubuntu Mate 18.10 Cosmic Cuttlefish

    Re: NoMachine NX: simple setup without adding users

    Quote Originally Posted by AlesZib View Post
    Hello!

    I have followed the how to, however am unable to connect. I'm trying to connect to Ubuntu 8.10 - Intrepid Ibex from Windows XP.

    The installation seemed to go smoothly on both, but if I try to connect, I get the following error:
    "Authentication failed for user (username)".

    I can log in to the server via ssh as an nx user.
    Also, I ran
    nxserver --usercheck <username>
    and the output indicated that everything is ok.

    Does anybody have any ideas what could be wrong?

    Thanks in advance
    If you can log into the nx server as "nx" using the imported key, you should be able to connect via the gui. Reimport the nx key into the gui and try again. That said, this was tested using hardy not intrepid so I'm not aware of any gotchas that intrepid may have introduced.

  10. #10
    Join Date
    Dec 2008
    Beans
    10

    Re: NoMachine NX: simple setup without adding users

    Thanks for the reply. I would just like to add that if I use a wrong key-file, I get a different response, namely that NX service is not available.

    I have a feeling that users could be set wrongly. Can I somehow that that from the server or using SSH?

    Thanks for the reply,
    Ales

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •