Prevent specific keyboard inputs

Forums / NoMachine Cloud Server Products / Prevent specific keyboard inputs

This topic contains 1 reply, has 2 voices, and was last updated by Avatar Gega 1 year, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #18059
    Avatar
    devon
    Participant

    I am using Enterprise Desktop Linux.

    When a user logs into the system via NoMachine, I don’t want the user to be able to access the super keys / Windows key.

    I have tried to use both the hooks in the node.cfg

    UserScriptAfterSessionStart “/usr/bin/user-restriction.sh”

    UserScriptBeforeSessionStart “/usr/bin/user-restriction.sh”

    to execute a xmodmap command to bind the super key to nothing.

    For example:

    #!/bin/bash

    xmodmap -e “keycode 133=”

    will result in the following output :

    xmodmap:  unable to open display ‘:1002’

    xmodmap -e ‘keycode 133=’

    Is this the correct approach to changing keymappings with NoMachine?

    Or

    Is there config that can be manipulated to change the mappings ?

    Thank you

    #18098
    Avatar
    Gega
    Participant

    Hello devon,

    xmodmap command needs X authorization to work properly, therefore it’s necessary to set correct path for x authority cookie. Here’s an example how to correctly set environment variables and run xmodmap:

    
    #!/bin/bash
    
    export DISPLAY=":$4"
    
    export XAUTHORITY="$NX_SYSTEM/var/log/node/C-$(hostname)-$4-$1/authority"
    
    xmodmap -e "keycode 133="
    

    This script needs to be run on UserScriptAfterSessionStart event.

    • This reply was modified 1 year, 4 months ago by Avatar Britgirl.
    • This reply was modified 1 year, 4 months ago by Avatar Gega.
    • This reply was modified 1 year, 4 months ago by Avatar Gega.
Viewing 2 posts - 1 through 2 (of 2 total)

This topic was marked as solved, you can't post.