Prevent specific keyboard inputs

Forum / NoMachine Cloud Server Products / Prevent specific keyboard inputs

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #18059
    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
    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 6 years, 7 months ago by Britgirl.
    • This reply was modified 6 years, 7 months ago by Gega.
    • This reply was modified 6 years, 7 months ago by Gega.
Viewing 2 posts - 1 through 2 (of 2 total)

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