Every major Linux desktop nowadays comes with a screensaver program by default (e.g., xscreensaver), which then can be used to lock the screen for security purposes. The default screensaver is typically configurable, and you can change settings like inactivity period or screen lock delay. You may want to adjust these settings based on your typical work environment. Also, in case you want prevent your screen from going off and locked down for an extended period of time (e.g., when watching a movie), you probably want to disable screen lock feature.
In this tutorial, I am going to show how to control screen lock on various Linux desktop environment.
GNOME 3 Desktop
Go to "System Settings" -> "Brightness and Lock". In this setting, you can set screen inactivity period and screen lock delay. Also, you can enable or disable screen locking.
If you want to control screen lock from the command line, here is how to do it.
To activate screensaver and lock the screen after 10 minutes:
To disable screen lock:
Alternatively, you can use dconf-editor, a GUI-frontend for dconf command.
To install dconf-editor on Debian, Ubuntu or Linux Mint:
To install dconf-editor on Fedora:
To launch dconf-editor, simply run it.
Go to "System Settings" -> "Display and Monitor". Choose "Screen Locker" menu in the left. Here, you can change screen inactivity period and screen lock delay. Also, you can enable or disable screen locking. In this example, screensaver will be launched after 15 minutes of inactivity. After 300 seconds from that point on, screen lock will be activated, requiring password authentication.
To adjust screen lock settings from the command line, you can edit ~/.kde/share/config/kscreensaverrc. Create the file if it does not exist. Once the file is edited, the change will automatically take effect immediately.
[ScreenSaver] Lock=true LockGrace=300000 PlasmaEnabled=false Timeout=900
To disable screen lock, simply change the following setting in ~/.kde/share/config/kscreensaverrc.
Go to "Settings Manager" -> "Screensaver". In this settings, you can change screensaver activation time and screen lock delay, as well as enable/disable screen lock.
Once you change screensaver preferences via GUI like above, it will create ~/.xscreensaver, which is a screensaver preference file. You can also edit this file manually to adjust screen lock settings, without going through GUI.
To disable screen lock, simply change the setting in ~/.xscreensaver
Linux Mint MATE/Cinnamon Desktop
You can follow the same steps as in GNOME 3 desktop.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to install Suricata intrusion detection system on Linux - September 3, 2015
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015