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.

jcharaoui
  • 346
  • 1
  • 10

1 Answers1

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
slm
  • 369,824
  • 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.) – q9f Oct 11 '13 at 15:35