How can one programmatically freeze the Keyboard & Mouse temporarily, so that no one could mess with the system?There are several possibilities where this is useful.  For instance, I have a laptop and I want to make sure no one uses it while I leave, even if somebody knows the password or can guess it (like wife or children), as well as depressing thieves' appetite (as it seems dis-functioning).  or I'm doing something remotely so I want to make sure the user at the computer doesn't disturb. 
Disable Keyboard & Mouse input on unix (under X)
xorg;keyboard;mouse;input
Assuming your GUI is X-based (as almost all UNIX GUIs are), use xinput.First, list your devices:$ xinput --list Virtual core pointer                          id=2    [master pointer  (3)]    Virtual core XTEST pointer                id=4    [slave  pointer  (2)]    Windows mouse                             id=6    [slave  pointer  (2)] Virtual core keyboard                         id=3    [master keyboard (2)] Virtual core XTEST keyboard               id=5    [slave  keyboard (3)] Windows keyboard                          id=7    [slave  keyboard (3)]List the details for your mouse (id=6 in our example):$ xinput --list-props 6Device 'Windows mouse':    Device Enabled (112):   1    Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000,   1.000000, 0.000000, 0.000000, 0.000000, 1.000000    Device Accel Profile (222):     0    Device Accel Constant Deceleration (223):       1.000000    Device Accel Adaptive Deceleration (224):       1.000000    Device Accel Velocity Scaling (225):    10.000000Now disable it:$ export DISPLAY=:0$ xinput set-int-prop 6 Device Enabled 8 0To enable it do:$ xinput set-int-prop 6 Device Enabled 8 1The same goes for the keyboard, just replace the int-prop number with the proper id.Tested and worked on cygwin.Of course, you have to plan beforehand how will you enable your devices again.  such as schedule it on cron, re-enable it remotely, or disable just one of them in first place.