Unable to take sddm login screenshot

I’m trying to take a screenshot of the sddm login screen (sddm or sddm-greeter), which is in tty1. I run the commands from tty2 and immediately return to tty1 but doesn’t work.

$ sleep 15; xwd -out screenshot.xwd -root -display :0.0
Authorization required, but no authorization protocol specified

xwd:  unable to open display ':0.0'

This other command doesn’t work either:

$ TMPXAUTHORITY=$(ls /var/run/sddm/*); sleep 15; DISPLAY=:0 XAUTHORITY=$TMPXAUTHORITY xwd -root > "~/Desktop/greeter.xwd"
Authorization required, but no authorization protocol specified

xwd:  unable to open display ':0'

In order to do this, you have to be logged in at the tty as root. Use… :arrow_down:

sudo -i

… as the first command after logging in at the tty. Then issue the other commands.

Great, got it working, these are the steps:

  1. In tty1 logout from Plasma sessions, so sddm-greeter is there.
  2. Switch to tty2 with CONTROL+ALT+F2 and login as root there, then run there sudo -i
  3. Run the script capture-sddm.sh in tty2
  4. Switch quickly to tty1 with CONTROL+ALT+F1 and wait 20 seconds to take screenshot
  5. Now the screenshot is in /root/ folder

This is the script capture-sddm.sh to be run as root:

TMPXAUTHORITY=$(ls /var/run/sddm/*)
sleep 15
DISPLAY=:0 XAUTHORITY=$TMPXAUTHORITY xwd -root > /root/greeter.xwd
convert /root/greeter.xwd /root/greeter.png
rm /root/greeter.xwd

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.