Console Input – Locking Console Input Without Screen Blanking

console

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.

Best Answer

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
Related Question