Login Screen Capture Under GDM/MDM and LightDM
Published on 27 December 2015 by amjUpdated: 09 July 2021 --amanda
GDM/MDM:
#!/bin/bash
#********************************
# Created YYYYMMDD --[USER]
#
#********************************
stamp=$(date +%Y%m%d-%H%M%S)
chvt 7 ; sleep 5 ; XAUTHORITY=/var/lib/mdm/:0.Xauth DISPLAY=:0.0 import -window root /home/[USER]/"$stamp"\ -\ gdm-shot-001.jpg
The critical piece is the path /var/lib/mdm
chmod a+x ./capture
sudo ./capture
sudo chown [USER]: ./"$stamp"\ -\ gdm-shot-001.jpg
LightDM (Shitty, shitty, super shitty, beyond shitty lightdm):
Reference: https://www.ubuntubuzz.com/2020/01/take-screenshot-of-lightdm-login-screen-in-2020.html
#!/bin/bash
#********************************
# Created YYYYMMDD --[USER]
#
#********************************
stamp=$(date +%Y%m%d-%H%M%S)
chvt 7 ; sleep 5 ; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 import -window root /home/[USER]/"$stamp"\ -\ lightdm-shot.png ; chvt 1
The critical piece is the path /var/lib/lightdm/root/
chmod a+x ./capture
sudo ./capture
sudo chown [USER]: ./"$stamp"\ -\ lightdm-shot-001.jpg