If I understand correctly, what you need to do is set the “lock the physical screen on disconnect”. This is useful in conjunction with screen-blanking.
When the screen blanking feature is activated, the remote screen is blanked, and the remote keyboard and mouse are locked whilst the user is connected by NoMachine. I.e. operations made on the physical screen by the NoMachine user are not shown and the local user cannot interact with the desktop until the NoMachine user logs-out.
As soon as the session is disconnected, the remote screen is unblanked, mouse and keyboard are released. To avoid this, it’s possible to activate the automatic lock of the screen, even if the user didn’t lock the screen before disconnecting by NoMachine.
See here more details:
https://www.nomachine.com/protecting-the-host-screen-during-a-remote-control-session
and
How to enable screen blanking and the automatic lock of the screen
https://kb.nomachine.com/AR07M00851