NoMachine Support

Your questions answered

Knowledge Base

Searching in: Feature Requests
Filter the search results
Target version:
Products:
Status:
Last update:
Searching in: Feature Requests
ID: FR08R04011
Added on:  2020-08-06
Last update: 2020-12-17
Priority: High
Products: NoMachine Server
Implemented in: 7.0.208
Status:  Implemented
Forcing a system logout when the user disconnects from the physical display

In case of connections to the physical display of the remote computer, it can be convenient to force a system logout when the user closes the NoMachine session.

This feature applies to the Enterprise Desktop (used as a standalone server) and to a multiserver environment in which the Enterprise Desktops are federated under a Cloud Server.

The system logout will be triggered by the execution of a script upon the closure of the NoMachine session. This script invokes the system command to force the logout, but it's up to administrators to specify the appropriate command to be used. Due to great variety of supported systems, the script provides by default just some most common examples.

This script, named forcelogout.sh, is placed under the NoMachine installation directory:
- /Applications/NoMachine.app/Contents/Frameworks/scripts/env/forcelogout.sh on macOS
- /usr/NX/scripts/env/forcelogout.sh on Linux
- %ProgramFiles(x86)%/NoMachine/scripts/env/forcelogout.bat on Windows

How to enable the automatic logout upon disconnection

Let's distinguish two cases:

a) The Enterprise Desktop is used as a standalone server

b) The Enterprise Desktop is part of a Cloud Server multi-server environment (it's a child server of the Cloud Server).


Case a) Enterprise Desktop as a standalone server

1. Edit the forcelogout.sh script and specify the command to logout, appropriate for your operating system.

2. Edit the server.cfg file and enable the following key:

LogoutOnDisconnect 1

When this key is enabled, NoMachine will try to execute the forcelogout.sh script. The automatic logout will be effective only if the command set in the forcelogout.sh script is appropriate.
 

3. If you need to execute the logout after a certain period of time, enable also the following key and specify a time value in seconds. The logout command will be executed when the timeout expires:

LogoutOnDisconnectTimeout 0

This is the default, the command to logout is executed immediately.

To delay the execution of the command, set the timeout in seconds. For example:

LogoutOnDisconnectTimeout 600

NoMachine will wait for ten minutes before executing the command to logout. If the user connects again by NoMachine in the meantime, the command to logout will not be executed.

 

Case b) Enterprise Desktop being part of a multiserver environment

1. Edit the forcelogout.sh script on each Enterprise Desktop and specify the command to logout, appropriate for your operating system.

2. On the Cloud Server host, set the appropriate profile rule to enable the automatic logout upon disconnection. The rule will be propagated to all child servers' levels.

The rule can be applied

2.1. on a per-server basis:

nxserver --ruleadd --class propagation --type enable-logout-on-disconnect  --value yes --server <server:port>|<uuid>

To disable it:

nxserver --ruleadd --class propagation --type enable-logout-on-disconnect  --value no --server <server:port>|<uuid>

To delay the execution of the logout command, specify in --value  the amount of seconds to wait before executing the logout command (by default the command is executed immediately). For example, to delay the execution of 20 minutes:

nxserver --ruleadd --class propagation --type enable-logout-on-disconnect --value yes --server <server:port>|<uuid>

to enable logout and than use:

nxserver --ruleadd --class propagation --type logout-on-disconnect-timeout --value 1200 --server <server:port>|<uuid>

2.2. or on a per-group of servers basis

Create the group of servers:

nxserver --servergroupadd SERVERGROUPNAME

and then apply the rule to enable the automatic disconnection for that group:

nxserver --ruleadd --class propagation --type enable-logout-on-disconnect  --value yes --servergroup <groupname>

To disable the automatic logout:

nxserver --ruleadd --class propagation --type enable-logout-on-disconnect  --value no --servergroup <groupname>

To delay the execution of the logout command, specify in --value the amount of seconds to wait before executing the logout command (by default the command is executed immediately). For example, to delay the execution of 20 minutes:

nxserver --ruleadd --class propagation --type enable-logout-on-disconnect --value yes --servergroup <groupname>

to enable logout and than use:

nxserver --ruleadd --class propagation --type logout-on-disconnect-timeout --value 1200 --servergroup <groupname>

 

Two new server configuration keys will be added:

#
# Enable or disable the automatic logout of the user from the system
# upon disconnection of the NoMachine session.
#
# 1: Enabled. NoMachine will execute the forcelogout.sh script. The
#    automatic logout can be effective only if the command set in
#    script is appropriate for the system.
#
# 0: Disabled. When disconnecting the NoMachine session, the user is
#    not automatically logged out of the system.
#
#LogoutOnDisconnect 0

#
# Delay the execution of the logout command when 'LogoutOnDisconnect'
# is enabled. By default timeout is set to 0, i.e. the forcelogout.sh
# script is executed immediately as soon as the user disconnects the
# session. Specify a delay in seconds, for example 600 to execute the
# logout after ten minutes.
#
#LogoutOnDisconnectTimeout 0