How to disable and enable keyboard in ubuntu?
To Disable/Enable the keyboard, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
xinput -list
Once you find your ID, then
sleep 0.1 ; xinput set-prop 9 'Device Enabled' 0 ; sleep 5 ; xinput set-prop 9 'Device Enabled' 1
sleep 5 is the number of seconds (I guess) you want the keyboard to be disabled.
For more information on the xinput command see the ManPage.
Or you can use Lock keyboard utility.