Knowledge Base
Searching in : Article
ID: AR08M00854
Applies to: NoMachine Server
Added on: 2015-08-10
Last Update: 2025-03-31

How to terminate NoMachine virtual desktops sessions automatically

The NoMachine server can be configured to automatically terminate Linux virtual desktops that are in status 'disconnected' in two ways:

i) When the maximum number of virtual desktops is reached on the server.

To terminate a disconnected session when the maximum number of virtual desktops is reached and make room for a new virtual desktop, enable the following key in the server.cfg file:

EnableAutokillSessions 1
 

ii) After a specific period.

To define for how long the server has to keep alive a virtual desktop in status disconnected, set the following key in the server.cfg file:

DisconnectedSessionExpiry <value>

<value> is expressed in seconds. When this time is elapsed the server will terminate the virtual desktops.

For example, by setting 'DisconnectedSessionExpiry 600' in the server configuration file a virtual desktop will terminate after ten minutes provided there is no activity.

In case of multinode envrionments, if the main server is Enterprise Terminal Server, it's enough to set that key in server.cfg of the main server. If it's instead a Cloud Server, it's necessary to set the key in server.cfg on the node.


The EnableAutokillSessions key can also be used in conjunction with the DisconnectedSessionExpiry setting. E.g., setting the following in the server configuration:

VirtualDesktopsLimit 10
EnableAutokillSessions 1
DisconnectedSessionExpiry 86400

will limit the number of virtual desktops to ten and keep alive a virtual desktop (inactive & disconnected) for one day. If a new virtual desktop is requested, the server will terminate the oldest virtual desktop in status disconnected to make room for the new session.

 

 

Note about disconnecting virtual desktops

Virtual desktops can still be disconnected by the user, but administrators may want to enable the automatic disconnection after a certain time of inactivity. This can be done by setting the node configuration file (node.cfg):

DisplayAgentExtraOptions "-timeout s"

where s is expressed in seconds.

For more details about disconnecting virtual desktops, please refer to https://www.nomachine.com/AR01H00551