Knowledge Base
Searching in : Article
ID: AR07P00989
Applies to: NoMachine Server
Added on: 2018-07-17
Last Update: 2018-11-14
Print this article

How to disable specific session types (e.g. custom sessions) on Linux

The supported types of sessions are defined in the AvailableSessionTypes key in the server configuration file. This key is populated automatically during the installation of NoMachine according to resources present on the system and eventual limitations of the license. See the Appendix section of this article for a complete list of session types and their description.

In order to disable a certain type of session, it's enough to remove it from the list of types in the AvailableSessionTypes key in the server.cfg file. This will apply to the whole system, also in case of a multi-node environment (Enterprise Terminal Server + Terminal Server Nodes).

In multi-node environments, edit the AvailableSessionTypes key in the server configuration and in the node.cfg file on each of the nodes where you want to prevent this kind of session types. Then, on the main server host synchronize information by executing the 'nxserver --nodeupdate NODE:PORT' where NODE:PORT is the name of the node as it appears in the output of the 'nxserver --nodelist' command.

Session types available on the node can be a subset of session types available on the main server.
 

 

How to disable custom sessions

For example, to remove the option of creating custom sessions (i.e. running single applications) and make the user to get directly the virtual desktop:

step 1: edit the server configuration file, /usr/NX/etc/server.cfg and make a copy of the AvailableSessionTypes key in order to preserve the original settings.

Comment out one of the two keys (prepend the '#' char to the key name).

step 2: remove all the types related to custom sessions from the other key:

unix-application
unix-default
unix-console
unix-desktop
unix-remote
unix-remote-custom

This will affect both connections via NoMachine client and via browser.

On our machine, the final result was:

#AvailableSessionTypes unix-remote,unix-console,unix-default,unix-application,physical-desktop,shadow,unix-xsession-default,unix-gnome,unix-xdm

AvailableSessionTypes physical-desktop,shadow,unix-xsession-default,unix-gnome,unix-xdm

 

step 3: restart the NoMachine server and all services:

/etc/NX/nxserver --restart

Note that this will terminate all the sessions running on the server host.
In case of a multi-node environment (Enterprise Terminal Server + Terminal Server Nodes), restarting the main server doesn't terminate sessions running on the remote node(s) but disconnect them.

 

How to disable RDP virtual desktops and/or XDM virtual desktops

In a similar way, it's possible to disable the possibility of running RDP virtual desktops by removing the windows type or disable creating XDM virtual desktops by removing the unix-xdm type.

For example:

#AvailableSessionTypes unix-remote,unix-console,unix-default,unix-application,physical-desktop,shadow,unix-xsession-default,unix-gnome,unix-xdm

AvailableSessionTypes unix-remote,unix-console,unix-default,unix-application,physical-desktop,shadow,unix-xsession-default,unix-gnome,unix-xdm
 

 

 

Appendix:

In order to retrieve the list of session types available on the server, run the following command:

/etc/NX/nxserver --resourcelist --class session

 

Session types and their descriptions are:

Session type Description
physical-desktop Connect to the physical desktop of the Terminal Server host.(*)
unix-xsession-default Run the default virtual desktop as set on the system.
shadow Connect to a virtual desktop session (desktop sharing/collaboration).
unix-console Run a virtual Unix console application.
It can be embedded into the client session window or be a floating window console depending on the user's choice: run or not the custom session in a virtual desktop
unix-desktop Run a virtual custom application embedded into the player session window.
unix-application Run a virtual custom application.
It can be embedded into the client session window or be a floating window application depending on the user's choice: run or not the command in a virtual desktop.
unix-gnome Run a virtual GNOME desktop.
The ConnectPolicy key in the server configuration must have 'desktop=1' set.
unix-kde Run a virtual KDE desktop.
The ConnectPolicy key in the server configuration must have 'desktop=1' set.
unix-xdm Run a virtual desktop through the X Desktop Manager.
unix-default Run a virtual session by using the default X client script on server.
unix-script Run a virtual session by using the X client script on server as specified by path.
windows Run a RDP session encapsulated in a virtual session.
vnc Run a VNC session encapsulated in a virtual session.

(*) Connections to the physical desktop are supported only for specific users.