How To Lock The Keyboard And Mouse, But Not The Screen In Linux

9 Responses

  1. César says:

    Thank you very much for this post SK. It is very useful.
    Only one suggestion. I think it is not necesary to write the command again in the custom shortcut command box.
    You have already created an executable file with the command inside, so if you select that file in the custom shortcut box (resulting in “/usr/local/bin/lockkbmouse”), it will work as well.

  2. Jarom Jackson says:

    Thanks! On kde I just added a global shortcut (ctrl+win+L) and had it call xtrlock directly (no need for a script file or the sleep command). Works great.

  3. Jo says:

    I’m afraid screenshots show the name of the program as “xtrclock”, which is unfortunate.

  4. Pete says:

    Thanks. Just what I needed

  5. Kev says:

    No mention of how to set the initial password, or how to change it?

  6. sk says:

    Just type your system user password.

  7. kevin snowden says:

    can i make this auto run after reboot?

    • sk says:

      You mean you want to lock keyboard & mouse on every reboot? Simply add this to your .bashrc file:


      But there is no point to automatically lock display. I won’t recommend doing it. You may permanently get locked out of the screen.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.