6

I'm looking for a method to lock/disable keyboard input into a text console (tty, no xorg) without blanking the screen. I would like to be able to monitor the on-screen progress of a long-running program (Partclone) without worrying about tampering at the keyboard (Ctrl-C, switching terminals, etc).

I'm aware of vlock, but it blanks the screen.

  • 1
    pull the plug of the keyboard :) – soc1c May 9 '13 at 10:46
  • Do you need the ability to unlock the keyboard as well (without rebooting)? – a CVn May 10 '13 at 7:32
3

This question really intrigued me, seemed like a simple request but was tricky to find options beyond the typical xlock, vlock and xset options.

However I believe I've found 2 methods to do this.

Method #1 - cat /dev/...

The first method basically consumes /dev/tty0 so nothing else can get through.

nohup cat /dev/tty0 > /dev/null &

Method #2 - disable usbhid module

The second method involves unloading the usbhid kernel module. This will only work if you have a USB keyboard.

modprobe -r usbhid

Method #3 - grub

You can disable all USB devices using the nousb parameter to the kernel via Grub.

kernel /vmlinuz-2.6.18-128.1.1.el5 ro root=LABEL=/ console=tty0 console=ttyS1,19200n8 nousb
  • Thanks, that's just what I was looking for. I like method #2 for its simplicity, and you can re-enable input just as easily afterwards. I won't prevent input from a PS/2 keyboard, but it doesn't matter to me since most of my equipment is USB-only. – jcharaoui May 13 '13 at 17:27
  • Method #1 does indeed consume keyboard input but also tty output. Are there any other ideas on this? (Non USB keyboards.) – soc1c Oct 11 '13 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.