Many of you will be familiar with the Windows screensaver/lock screen. If you are going to leave your PC alone for any amount of time where others may have access to it (like in a busy office) then it is advisable to lock it every time you walk away from it using the Win+L key combinations.
But we are talking about the Raspberry Pi here. If you are running it headerless or in command line mode and you are not logged in, then anyone who has access to it will need to log in (you have changed the default password, haven’t you?).
But what if you have a Raspberry Pi in Desktop mode? The same applies to a Raspberry Pi as it does to a PC; you should lock the screen if you walk away from it. This is especially important if you are using a Pi as a server and have Desktop mode running to help with management of a service.
A ‘screensaver’ is not installed by default, but a lock screen is; it’s has just not been put onto the menu. You can do that by editing a file that defines how your menus and toolbar appears.
Open a terminal window, and type in*:
sudo nano /etc/xdg/lxpanel/LXDE-pi/panels/panel
Scroll down (using the cursor keys) to the section that starts:
Move to the end if this section, and type in (or copy/paste) the following:
The file should look like this:
Save the file by typing typing Ctrl+x (the Ctrl key, with x), then ‘y’ to the prompt to save, and the Enter key.
After your next reboot, you will now see a new item at the bottom of your menu:
Now, when you are going to be away from your Raspberry Pi, all you need to do to secure it is to click on the Lock… menu and the screen will be locked:
Just type in your password, and your Pi and you can resume from where you left off.
* On older versions of Raspbian, you may find the configuration file in ~/.config/lxpanel/LXDE-pi/panels/panel instead.