Skip to content
Unix Server Solutions
  • Server
  • Apple
  • Database
  • Ubuntu
  • Linux

Ubuntu – How to take a screenshot of the login screen

login-screenscreenshot

How can I take a screenshot of the login screen?

I do not want to recreate my Ubuntu installation in a virtual machine.

Best Answer

This blog might be helpful: http://ptspts.blogspot.com/2010/02/how-to-create-screen-shot-of-gdm-login.html

Install ImageMagick for the image file format conversion below:

sudo apt-get install imagemagick

Create a helper script:

echo 'DISPLAY=:0 XAUTHORITY=/var/lib/gdm/:0.Xauth xwd -root' >/tmp/shot.sh

Make sure your login screen is active (log out or reboot the machine, and wait until you see the login screen). Log in in text mode (by pressing Ctrl-Alt-F1), or using SSH. Create the screen shot by running

sudo bash /tmp/shot.sh >/tmp/shot.xwd

You can log in now (by pressing Ctrl-AltF7 first to get back to the GDM login screen). Convert the screen shot to JPEG and/or PNG:

convert -quality 50 /tmp/shot.xwd /tmp/shot.jpg
convert /tmp/shot.xwd /tmp/shot.png

View the screen shot in your favourite image viewer.

Related Solutions

Ubuntu – way to take a screenshot of your log-in screen on startup

Modify the file /etc/gdm/Init/Default, by adding the following line

(sleep 10; gnome-screenshot) &

just before the last exit 0 line. Then logout and wait 10 seconds for the interactive screenshot dialog to appear.

It propose the /tmp directory to save the image, in any case take attention to where you save the file, to found it later, after login.

Remember to remove the line inserted in the file /etc/gdm/Init/Default to remove this annoying screenshot dialog every time you login :)

Ubuntu – capture login screen-not sucssecful

Step1:

Make /tmp/shot.sh using this command:

echo 'sleep 20; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root' > /tmp/shot.sh

You may change the seconds of sleep suitably.

Step2:

Login to the text mode by pressing Ctrl+Alt+F1.

Step3:

Execute this command;

 sudo bash /tmp/shot.sh >/tmp/shot.xwd

Step4:

Return to the GUI mode by pressing Ctrl+Alt+F7.

Step5:

Logout by normal way. While you can see login screen, wait for some seconds.

Step6:

Login by normal way. And execute this command in terminal;

convert /tmp/shot.xwd /tmp/shot.png

(you need to install imagemagick, if you don't have installed it yet)

So, you can check the picture using this command;

eog /tmp/shot.png

Reference: http://ptspts.blogspot.jp/2010/02/how-to-create-screen-shot-of-gdm-login.html

In 12.04, it differs in using lightdm.

Related Question
  • Ubuntu – way to take a screenshot of your log-in screen on startup
  • Ubuntu – capture login screen-not sucssecful
  • Ubuntu – How to take screenshot of complete webpages