How do I disable multiple chosen keys like Ctrl & Caps Lock from boot on Debian 11?
Mainly so they can't be used for system commands like opening the terminal or whatever else.
How do I disable multiple chosen keys like Ctrl & Caps Lock from boot on Debian 11?
Mainly so they can't be used for system commands like opening the terminal or whatever else.
This SuperUser article looks like it answers your question - It'll be the same principle
For me on Debian 12 (Bookworm), running xev -event keyboard from a terminal :
Pressing down the Ctrl key shows:
KeyPress event, serial 28, synthetic NO, window 0x5c00001,
root 0x5ae, subw 0x0, time 2231447, (-655,427), root:(794,709),
state 0x10, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
and releasing the Ctrl key shows:
KeyRelease event, serial 28, synthetic NO, window 0x5c00001,
root 0x5ae, subw 0x0, time 2231560, (-655,427), root:(794,709),
state 0x14, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
I would then substitute <value> in:
xmodmap -e 'keycode <value>='
with
xmodmap -e 'keycode 37='
For me:
(using the backup method below actually gives you a list of all the mappings if you run it then run cat ~/originalkeymap.xmod !)
This other SuperUser answer also demonstrates how to reverse it (log out and back in?!) and also back up the existing key map before making any changes - Always a good idea to test!
Backup
xmodmap -pke > ~/originalkeymap.xmod
Restore
xmodmap ~/originalkeymap.xmod
You may need to consider what would happen if someone could disconnect and reconnect the keyboard, and also if they attached a second keyboard - I.e. secure your environment.