Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
1  
pull the plug of the keyboard :) –  vertoe May 9 '13 at 10:46
    
Do you need the ability to unlock the keyboard as well (without rebooting)? –  Michael Kjörling May 10 '13 at 7:32

1 Answer 1

up vote 2 down vote accepted

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
share|improve this answer
    
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.) –  vertoe Oct 11 '13 at 15:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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