I'm using Ubuntu 12.04 . If more information is needed, please tell me. I Tried some guides to cature my login screen:

How can I take a screenshot of the login screen?


I tried the first one, but after running:

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

I'm getting this:

No protocol specified
No protocol specified    
xwd unable to open display ':0'

and i'm getting an xwd file in my tmp folder. running the other commands giving errors.

tried the second one, after running:

chvt 8; sleep 5; XAUTHORITY=/var/gdm/:0.Xauth DISPLAY=:0.0 import -window root /tmp/gdm-login-shot.png

I got:

No protocol specified
No protocol specified
import: unable to open X server ':0.0' @ error/import.c/ImportImageCommand/366 

Many Thanks for helping (:

EDIT to vine_user: here the output from the terminal-I cacked it from within the system while I'm looged in:

ubuntu@PrecisePangolin:~$ echo 'sleep 5; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAYDISPLAY xwd -root' > /tmp/shot.sh
ubuntu@PrecisePangolin:~$ sudo bash /tmp/shot.sh >/tmp/shot.xwd
bash: /tmp/shot.xwd: Permission denied
ubuntu@PrecisePangolin:~$ sudo su
root@PrecisePangolin:/home/ubuntu#  sudo bash /tmp/shot.sh >/tmp/shot.xwd
No protocol specified
No protocol specified
xwd:  unable to open display ':0'

EDIT 2!: HERE IT IS!: enter image description here

just uploading-this uploadong site is better than other iuset to use (: : enter image description here

  • Sorry, /var/run/lightdm/root/$DISPLAYDISPLAY was my misleading.Replace to /var/run/lightdm/root/$DISPLAY.
    – vine_user
    Aug 18, 2012 at 1:49
  • Never be sorry for helping (: you're helping me a lot! I'm going to try your solution, Thanks!
    – yinon
    Aug 18, 2012 at 17:16
  • And It's Working! Thanks SO MUCH! YOU Made My Day! Thanks! I'm Editing and I'll put my picture (: another thing, except that the display manager is different in Ubuntu 12.04 LTS, Have I done another things unright earlier? Could you please teach me a bit about my mistake and way it's wrong? It will help me in the future (: Thanks.
    – yinon
    Aug 18, 2012 at 17:46

4 Answers 4



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.


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


Execute this command;

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


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


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


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.

  • you mean: $ sudo bash sleep 20; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root >/tmp/shot.xwd ?
    – yinon
    Aug 17, 2012 at 16:27
  • I edited and put the output.
    – yinon
    Aug 17, 2012 at 16:37
  • OK, I will rewrite in detail, please wait a moment.
    – vine_user
    Aug 17, 2012 at 16:43
  • ok, I'm waiting for your new comment/answer. Thanks you for helping.
    – yinon
    Aug 17, 2012 at 16:45
  • I may be loggedout fron the site untill tomorrw night. it's just i have to go. I'll check your good answer then. Thanks again, you're great (:
    – yinon
    Aug 17, 2012 at 16:49

The answer by vine_user gave me a Black image so I modified it as below and got it correctly

  1. Make /tmp/shot.sh with the command echo 'chvt 7; sleep 10; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root' > /tmp/shot.sh
  2. Logout and login to text mode (Ctrl+Alt+F1)

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

  4. Return to GUI mode by pressing Ctrl+Alt+F7 (sometimes it is Ctrl+Alt+F8 - if it is your case then modify the fisrt command by replacing chvt 7 with chvt 8

  5. Use the command convert /tmp/shot.xwd ~/Desktop/shot.png to convert the /tmp/shot.xwd to ~/Desktop/shot.png (imagemagick is required)

Here is the screenshot of my login screen enter image description here


Try running the following command...

unity-greeter --test-mode  

... and taking a screenshot of that.

  • I need to capture my login screen which is with my username and background. and also the unity-greeter in the terminal is smaller. Thanks. more ideas?
    – yinon
    Aug 17, 2012 at 16:05

I have Written a small script to make it simple. I am sharing it here.

Install Step 1: Save this code into your home directory a file named loginsceenshot.sh

## Save this file in your home folder loginscreenshot.sh 
## make the file Executable 
## Hit Ctrl+Alt+F1 
## login and run program using
## sudo ./loginscreenshot.sh
echo "Waiting  .... "
echo "Now Go to Ctrl+Alt+F7"
sleep 15
echo 'Click ...  '
DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root > tmp.xwd
convert tmp.xwd ScreenShot.png
rm tmp.xwd
echo "ScreenShot is Taken, Please check your home directory and open 'ScreenShot.png'"

Install Step 2 Hit Ctrl + Alt + F1, login, and type this.

chmod +x ./loginsceenshot.sh
sudo apt-get install imagemagick

Use Step 1 Hit Ctrl + Alt + F1, login, and type this.

sudo ./loginsceenshot.sh

Use Step 2 Hit Ctrl + Alt + F7, goto Login page and wait for 15 sec.

Use Step 3 Open you home directory and look of ScreenShot.png


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.