This article applies to NoMachine v. 4 or later.
Support for key-based authentication with the NX protocol requires the public SSH key be added on the server side, in the user's home, to grant access. When you connect to the server you will have to insert the private key in the NoMachine User Interface (GUI) of whichever client device you are using.
Key-based authentication with NX protocol is available for all the NoMachine server products, including the free version.
You have already generated an SSH key pair, for example by using the ssh-keygen tool on a Linux host.
Be sure that the keys are in OpenSSH (old) format.
If you're using openssh version 7.8p1-1 or later, specify to generate the key in the old format:
ssh-keygen -m PEM -t rsa -b 4096
NoMachine doesn't support yet new OpenSSH format introduced by openssh version 7.8p1-1. Supporting it requires the implementation of this Feature Request: https://www.nomachine.com/FR05Q03834.
If you have generated the SSH key pair on Windows, for example by using PuTTYgen (https://www.puttygen.com), be sure it's in OpenSSH format or convert it. To do that choose the key file in the PuTTYgen main window. Then go to Conversions->Export OpenSSH key to export your private key and save it.
Add the public SSH key on the server
1. Navigate to the <user's home>/.nx/config directory.
Create this directory if it doesn't exist.
2. You should find there the authorized.crt file. Create this file if it doesn't exist. On Linux/Mac, this file needs to have permissions set to 0600.
3. Append your SSH public key at the end of the authorized.crt file. If you're using a text editor, be sure to not save the file in a different format.
4. Save changes.
This is an example of how the public key added to the authorized.crt file looks like:
Use the private SSH key when connecting with your client
On the user's computer:
1. Launch the NoMachine User Interface from Programs menu or Applications and right click on a connection. Choose 'Edit connection' to access connection settings.
2. Be sure that NX is the selected protocol in the drop-down menu.
3. Click on the Advanced button.
4. Choose 'Private key' authentication and click on the 'Settings' button.
5. Click the '...' button navigate directories and provide path to your private SSH key.
Since client version 5.1.7 it' possible to store the private key in the connection file by checking the 'Import the private key to the connection file' option.
6. Click on 'OK' button and connect.
The client will prompt you for username and passphrase. If your SSH key doesn't have a passhprase, leave this field empty.
- How to set up key based authentication with SSH protocol (not available with NoMachine free)
- How to use a SSH private key when connecting from NoMachine client