Disable / enable keyboard and mouse in Linux

Sometimes, you may need to disable mouse and keyboard on a remote server / PC running X (i.e. over SSH) and Linux (or any other operating system running X).

Here is how to do it:

  • First, list the devices your X sees:
  • Now, list details for the mouse (id=3):
  • Disable the mouse:
  • Enable the mouse again:
  • Disable the keyboard:
  • Enable the keyboard again:
  • You may find more details in "man xinput".