# NX / NoMachine¶

NX (aka NoMachine) is a computer program that handles remote X Window System connections which offers several benefits over traditional X forwarding.

NX can greatly improve the performance of X Windows, allowing users with slow, high latency connections (e.g. on cell phone network, traveling in Africa) to use complex X Windows programs (such as rotating a plot in Matlab).

NX provides functionality that allow a user to disconnect from the session and reconnect to it at a later time while keeping the state of all running applications inside the session.

Caution

Using NX requires both a recent NoMachine client and a recent connection file (specific to accessing NERSC). Please make sure you have recently updated versions of both of these.

## Installing the Configuration File¶

This is a compressed file, so you will need to extract/unzip it. Once you have done this, you need to click on this file so the NoMachine client can be configured. It will automatically open the NoMachine client when it does this. To return to the main menu, you can close the client and re-open it. You will need the main menu for the next steps of the connection process.

Depending on whether you are using the NERSC sshproxy service, we have two different sets of connection instructions below.

## Creating a connection to NERSC WITH sshproxy¶

If you don't wish to re-authenticate with your password and a new one-time password every time the NX Client is disconnected (e.g. if you close your laptop), you can connect with an ssh key generated by sshproxy. You will need to regenerate the ssh key with sshproxy once a day, but otherwise the NX Client will automatically reconnect.

Caution

Since the most recent NX update (Wednesday, April 10, 2019), using sshproxy is broken by default in NX. NoMachine has provided a workaround which will require you to manually edit one of your config files. Following step 9 in the directions below should fix this issue.

1. Install sshproxy on your laptop and generate an SSH key (instructions are here). Note that you must do this once every day to generate a new key.
2. Open the NX client and click the "New" box in the upper right corner of the menu.
3. Choose "SSH" for protocol and click Continue.
4. Type in "nxcloud01.nersc.gov" for Host (leave the port set to 22) and click Continue.
5. Choose "Private Key: use key-based authentication with a key you provide" and click Continue. DO NOT check import private key or forward authentication.
6. Fill in the path to the ssh key you generated in step 1 (usually ~/.ssh/nersc) and click Continue. Note that you may need to specify the full path to your ssh key rather than using the tilde (~).
7. Select "Don't use a proxy" and click Continue.
8. Choose the name you'd like to call this connection and click done. To make reconnecting easier you may elect to create a desktop icon ("Name of your connection.nxs") which will automatically load your NERSC connection settings. If you do not create a desktop icon, you can just click the NoMachine icon and then select the name of your connection.
9. SSHPROXY WORKAROUND: You will need to edit one of the NX config files on your local machine:
cd \$HOME/.nx/config
vi player.cfg

and change the following key from library to native:
<option key="SSH client mode" value="native" />

This should enable sshproxy to work with NoMachine.
10. To log on to NERSC NX, click on the connection you just created. You should not need to enter your username or password. At this point you should now be logged onto the NX desktop.

## Creating a connection to NERSC WITHOUT sshproxy¶

If you would prefer not to use the sshproxy service, you can still connect to NX. You will need to enter your password + OTP (no spaces in between) every time you log on to NX.

1. Open the NX client and click the "New" box in the upper right corner of the menu.
2. Choose "SSH" for protocol and click Continue.
3. Type in "nxcloud01.nersc.gov" for Host (leave the port set to 22) and click Continue.
5. Select "Don't use a proxy" and click Continue.
6. Choose the name you'd like to call this connection and click done. To make reconnecting easier you may elect to create a desktop icon ("Name of your connection.nxs") which will automatically load your NERSC connection settings. If you do not create a desktop icon, you can just click the NoMachine icon and then select the name of your connection.
7. To log on to NERSC NX, click on the connection you just created. You will need to enter your username and password+OTP. At this point you should now be logged onto the NX desktop.

## Troubleshooting¶

### Connecting to NX¶

If you are having trouble connecting to NX, please try these steps:

2. Re-download the NX configuration file. NX will often "update" the configuration file to try to save your settings and sometimes this file can get some bad settings. You must have the new NX player AND the new configuration file to connect to the NX service.
3. Try to ssh directly to the NX server. You can do this with the command
ssh <nersc_username>@nxcloud01.nersc.gov

and your NERSC user name and password+one-time MFA password (with no spaces in between). If your access to the NX server is blocked by a local firewall or something else and you can't connect via ssh, you will also not be able to connect with the NX client. If this is the case, please contact your local IT department.

If you've tried these steps and still cannot connect, please open a help ticket. In this ticket, please include the following information:

1. The type of system you're trying to connect from (i.e. Mac, Windows, Linux, etc.).
2. A screen capture of the error you get (if possible).
3. A tarball of the NX logs. You can find instructions for how to bundle your NX logs on the NoMachine website.

## Connecting via the Broswer Interface¶

Note

The browser interface is still experimental and can sometimes be slower than connecting via the client.

### Configuring the NX Environment¶

#### Font size is too big or too small¶

To change the font size inside your terminal: In the menu of Konsole Application, choose "Settings"->"Manage Profiles", then click "Edit Profile...", now you can change the font size in the "Appearance" tab, after changing, click "OK" until you are back to the terminal. Now every new terminal window you open will have the new font size.

To change the font size of your menu bars/window titles: Right click on an empty desktop then choose "Konsole", inside the Konsole, type "kcmshell4 fonts". Then you have a dialog box to change your font size.

#### Resizing the NX screen¶

With the latest NX Player (5.0.63 or later), the most efficient way is to enable "Remote Resize" in the NX menu:

1. Connect to NX
2. From the desktop, bring up the NX player menu with a hotkey: Mac: Ctrl+Option+0, Windows: Ctrl+Alt+0, Linux: Ctrl+Alt+0
3. Choose the "Display" submenu, then toggle the "Remote Resize" button. You can also choose "Change Settings" to manually change the resolution.

#### Emacs complains about missing fonts and shows white blocks¶

This is due to a problem with font server. Please use the following command instead: emacs -font 7x14

If you dislike the default NX terminal color scheme (white background, dark text), you can open a terminal from the Show Applications menu at the bottom of the menu bar on the left hand side of the screen (it looks like 9 dots). Once you have opened your terminal, click EditPreferences in the terminal menu. If you click the Colors menu at the top of the window, you can uncheck the Use colors from system theme box. You can then choose the color of the background and text you prefer.
If you like to make adjustments from the command line, open a terminal/konsole from the Show Applications menu and enter:
dconf write /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/use-theme-colors false

To change your keyboard language from the default (US English), click the Show Applications menu at the bottom of the menu bar on the left hand side of the screen (it looks like 9 dots). Then click the Settings icon → Region and Language. Under Input Sources, click the plus arrow on the bottom left hand side. This should open a list of additional options (for example: Spanish (Spain)). Under this menu will be another, more detailed submenu with options such as Spanish (Macintosh). Choose your option and click the Add button on the upper right hand side. Then under input sources, make sure your new option is highlighted. You can click the keyboard icon on the bottom right to see how the keys in your new configuration are arranged.