Take the 2-minute tour ×

Day to day I'm seeing many questions which say:

  • Screensaver/lock doesn't work.

  • Screensaver doesn't require password after waking or doesn't lock the screen.

  • Can not exit screensaver / nothing works after pressing key or moving mouse.

  • and many many more not specific with gnome-screensaver only but also with xscreensaver.

So how to make a simple, fast and lightweight screensaver which locks the screen after given time and requires the password in order to continue?

In addition to my answer, I request to others who have other answer to share here.. :)

share|improve this question

3 Answers 3

Trusty has a built in screen locker that can be easily configured using the "Brightness and Lock" applet in "System Settings"

share|improve this answer

A tutorial to build a custom screen-lock

  1. Install two packages by executing following commands:

    sudo apt-get install xautolock xlockmore
  2. Once installed enable xlock daemon on every time system starts by adding the entry to Startup Applications. Following steps will help:

    • Open Startup Applications:


    • Click Add button to open Add Startup Program window.

      Then fill with xautolock -time 10 in Command text-box. It will lock the screen after every 10 minutes if the system is being idle for 10 minutes. 10 can be replaced by any natural number. Click Add and then finally Close. Following screen will help:


  3. That's it. A simple screen-lock is ready! :) Login and Logout to check whether it is working or not.

  4. To stop the xlock daemon i,e if don't want to lock the screen any more type followng command in terminal:

    xautolock -exit

    also remove the command under Starup Applications. Get more options and help by: man xautolock and man xlock.


Working can be checked by executing following command if above two packages are installed:

xautolock -time 1

If left idle for 1 minute the system will be locked. Actually the command runs the executes the xlock daemon which locks the system.

Feel free to edit it to make it more clear and interactive. Any types of comments and suggestions are most welcome.

Thank You!!

share|improve this answer
Why a down-vote? It is tested and working nice!! If someone get any problem, I request to post it in comment. So that I'll try to solve the problem. Some people are so mean here. :( –  Saurav Kumar Oct 25 '13 at 19:06

If you just want a very simple screenlocker, try slock:


It's a pure screen locker though, no screensaver functionality. But the code is kept very simple (just 300 LOC) so you should experience no bugs.

To launch slock automatically after a timeout, use xautolock as Saurav suggested.

share|improve this answer

Your Answer


