May 12 2008
Login Screenshot Challenge - Part 1
In my last post I was showing various options for working with the root account. Near the end of the post I was planning to show how when logging in as root, the login dialog does not offer root as one of the available login names.
Attempting to capture the login screen has been an interesting diversion. Up to this point I’ve been unsuccessful in capturing the elusive screenshot.
So here’s a challenge for you…can you be the first to figure out how to capture a screenshot of the login screen for the root account? There are a couple of ground rules:
- You must be running Leopard (or at a minimum, the solution must work on Leopard).
- I’d like this to be a “free” solution, as in, no software to buy.
- Finally, I am looking for a solution that doesn’t require more than one Mac (e.g. using SSH from one Mac to another).
To save you some time, I’ve listed below the options I’ve tried:
Attempt #1 - Hotkeys
From the login screenscreen, I tried the following hotkeys:
- Shift+Command+3 (capture entire screen to file)
- Control+Shift+Command+3 (capture entire screen to clipboard)
- Shift+Command+4 (capture area defined with mouse to file)
Each of the above greeted me with a pleasant beep, nothing more.
Attempt #2 - Grab application
My next attempt was to try the timed capture option with the Grab application. Seemed like a clever idea, however, when I started the timer and logged out (to get to the login screen), Grab just seems to quietly go away. No warning, no error, no screenshot.
Attempt #3 - Fast Switching
Next, I enabled fast user switching. My thinking was, maybe if I don’t logout per se, and request the Login Window (see the figure below) that the login screen might somehow be different (as in, something I can capture using hotkeys):

Seemed logical, however, first notice that the root account doesn’t show up in the list of available accounts. Next, upon choosing Login Window I was shuffled over to the same login screen as if logging out. No luck.
Attempt #4 - Getting a little more creative, I tried this from within a terminal:
screen -d -m bash -c “sleep 30; screencapture /Users/John/login.png”
This option uses a screen manager (more on that in an upcoming post) and calls the screencapture application after sleeping for 30 seconds. Once I ran this option from a terminal, I quickly logged out and patiently waited…I heard the camera sound of the screencapture application and was psyched, “yes!”…I navigated to my home directory and located the file login.png…I opened the file with the Preview application…and much to my dismay…it was an image alright…a big, black, blank image. So close, but no cigar.
So, now it’s up to you. Can you figure what it takes to capture the login screenshot? You can submit your idea as a comment (below) or drop me an email. And please verify your trick works with Leopard, as other published solutions I’ve found seem to work only on releases prior to Leopard.
I’m doing my best to see if I can find a volunteer to donate a prize (software, book, t-shirt, etc). If that doesn’t come through, what I can offer is a little lime-light, blog style. If you are the first to contact me with a solution (within the parameters above), we can collaborate on a post where you can tell the world how you got so smart :) and share your bio, picture, blog/website, etc.
If anyone reading is interested in donating a prize, contact me and we’ll get the ball rolling.
I am very intrigued to see if/how this can be done.
Tips by RSS
Tips by Email

You can probably do it using Timbuktu
What about using cron? The ‘at’ command is not on my Leopard machine but that might work as well.
2andrej: Haven’t tried, but I guess cron won’t work for the same reason as
“screen -d -m bash -c “sleep 30; screencapture /Users/John/login.png””
didn’t work. The user which is running the command doesn’t have access to the active screen. Maybe it can be done with VNC (run server, then connect and use VNC client to make the screenshot)? Unfortunately, I don’t have time to try that, maybe someone will take it as inspiration :)
For sure you can do this via ARD, probably via screen sharing too, though the screen shot will be captured on the machine that you are using to remote into your logged out machine from.
The ARD Send Unix command (as root) screencapture /Users/ladmin/Desktop/login.png where ladmin is my local account worked with no problem, great if you have ARD.
You can use ssh to run the same command, though you may need to use sudo, which means that you’ll need an admin account to ssh into.
Finally, a cron or launchd task run as root should do it.
Ideally, I am looking to do this without having to use another machine (ARD or SSH). Have you tried using cron or launchd to accomplish this? The screen manager approach was close, however, the screenshot came up blank.
I tried the ssh, logging in as my local admin account and using sudo su - to switch to root, but when I run the screencapture I get nothing but black.
I also tried both the launchd and cron and still got black… Not quite sure what’s going on there.
As far as I know, the ssh should be the same as the ARD Send Unix, but the latter works and the former doesn’t. Will think on it some more, try to find out what the difference is.
Thanks for taking the time to tinker with this…it’s a rather addicting problem to try and figure out :) I’m on to a few ideas that I’ll share tonight/tomorrow…
Every user gets their own copy of the window server. So, you have to be logged in as whatever user actually shows the login window to have a chance of taking a screen shot of it. Not sure Grab.app will run as root, though, the login session may not have a full user account for running a GUI application, so this may still not work.
You need to connect via ssh from another mac.
Enable remote login on the target computer for a specific user, take not of the ssh address it gives you.
Also enable quick user switching then switch out to login screen (while remaining logged on your network connection will remain active)
On your second mac open terminal and enter ssh @, it will prompt for user verification.
Then enter:
cd ~/Desktop
sudo screencapture -ttiff loginwindow.tiff
This will create a screenshot of the target mac and save in format .tiff
It will be saved on the Desktop of the target computer.
This is best done on a mac that has a higher resolution than the target computer, otherwise you will need to crop the screenshot.