Taking screenshots in Debian is super easy. You will definitely know how to use the built-in screenshot utility or PrtScr key on your keyboard in order to take a screenshot of your system. There are other many open-source screenshots utilities that allow you to take screenshots of your system but they lack some functions. But what about if you need to take a screenshot of your lock screen or the login screen of your Debian system. Regardless of the reason why you need the screenshot of the lock screen or the login screen, we will show you how to achieve that.
This article shows you how to take a screenshot of your Lock screen and login screen.
We have run the steps and procedures mentioned in this article on a Debian 10 system.
Method #1 Using the Screenshot utility
Taking Screenshot of Lock Screen
In the following method, we will discuss taking a screenshot of lock and login screen using the built-in in screenshot utility. to open the screenshot utility, hit the super key on your keyboard, and the type screenshot in the search bar. When the result appears, click on the utility to open.
When the utility opens, change the value of Grab after a delay of to 6 seconds. Then click the Take Screenshot button.
Now lock your system using the system menu or using the shortcut Super + L key combination. Wait for few seconds until your lock screen is captured by the screenshot tool.
Then unlock your screen and you will see the screenshot utility asking to save the screenshot. Type the name of the screenshot and choose the directory to save the screenshot in your desired location. Once done, click the Save button.
Taking Screenshot of Login Screen
Open the Screenshot utility in the same way as described above. When the utility opens, change the value of Grab after a delay of almost 10 seconds or more than that. Then lock your system using the system menu or using the shortcut Super + L key combination.
Now try to unlock your system by swiping up the screen within the above-defined time range like in our case it is 10 seconds. When you swipe up the screen, your login screen will appear and within the defined 10 sec range, it will be captured by the screenshot utility.
Once the screenshot is captured, enter the password to login to your system. After logging in to the system, you will see the screenshot utility asking to save the screenshot. Enter the name and choose the directory to save your screenshot.
Method #2 Using the ImageMagick utility
In the following method, we will use the ImageMagick utility in order to take a screenshot of our login screen. Note down that this utility will only take the screenshot of just the login screen, not the lock screen. To perform this method, we will be using the command line Terminal application.
Open the terminal by going into the activities at the top left corner of your desktop. Then using the search bar, search for the Terminal application. When the result appears, click on the Terminal to open.
Now run the following command in Terminal if you do not have ImageMagick utility installed.
$ sudo apt-get install imagemagick
Now we will need to create a script that will enable ImageMagick to capture the screen after 10 seconds of running the script. Create a script named screenshot-login using the following command in Terminal.
$ sudo nano screenshot-login.sh
Now copy-paste the following lines in the script file named screenshot-login.sh:
chvt 7; sleep 10s; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 xwd -root -out ~/loginscreen.xwd; convert ~/loginscreen.xwd ~/loginscreen.png; rm ~/loginscreen.xwd
Once done, use Ctrl+O to save and Ctrl+X to close the editor.
If you are running a gdm3 display, you will need to switch to lightdm display to run the script. First, install lightdm display by running the following command in Terminal:
$ sudo apt-get install lightdm
Then run the following command to switch to lightdm display:
$ sudo dpkg-reconfigure lightdm
To switch back to gdm3 display, you can use the same command by replacing lightdm with gdm3.
Now run the following command in Terminal to make the script executable:
$ sudo chmod +x screenshot-login.sh
Now restart your system and press Ctrl+Alt+F1 on the login screen to shift to console mode. Enter the user name and password to log in and then run the following command:
$ sudo ./screencapture.sh
After running the script, you will be taken back to the login screen. Wait for 10 seconds as defined in the script, after which the screenshot of the login screen will be captured in your Home directory.
In this article, we have learned how to take the apparently impossible screenshot of the lock and the login screen in a Debian system using the built-in screenshot tool and the bash script.