Industry guru Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, Google AdSense, MySpace, Sony PSP, Apple iPod, Mp3 players, management, Linux, SEO, Mac OS X, Facebook, Twitter, LinkedIn and Microsoft Windows.

Can I Spy on Another Mac User?

I have been an avid reader for some time but I have a question. The kids all have computers now (we all have macs) and I was wondering if there was a way to check up on them every once in a while. We all have macs running OS X. and I have read the oriely 'control' your mac from afar. but I was wondering if there was a cool way to login screenshot and logout through SSH, I am the only admin so I can get their passwords, I was just wondering about the process.


Dave's Answer:

A very interesting question, and I'm sure there's a solution, actually. The key is a simple command-line utility included with Mac OS X called screencapture.

Checking the man page for the command (in the Terminal application, type man screencapture) (you can find Terminal in Applications --> Utilities, in case you haven't used it before) (that's a lot of parens, too. I feel like I'm back programming LISP again) (eek!) there are two key flags you want to utilize:

-S: In window capture mode, capture screen, instead of window
-x: do not play sounds

Probably, you also want to point to the main monitor, in case there's more than one screen hooked up, in which case you'll also want to specify -m. The full command should look like this:

screencapture -Smx screenshot.png

This would take a single screenshot and save it in the file "screenshot.png". Now just open up your home directory through Apple's standard file sharing capability and you should be able to refresh the directory occasionally, reopen this file, and you can see what they're doing.

Of course, if you want to go a bit, um, overboard, you could turn this into a shell script that will run every "X" seconds, saving a new screenshot in a hidden directory. Like this:

#/bin/sh

# Every few minutes take a screenshot, keep the last X around

keeparound=10 # how many to keep around. Don't fill your disk!
counter=1
screendir="/tmp/.captures"
delay=300 # in seconds. 300 = five minutes

if [ ! -d $screendir ] ; then
  mkdir $screendir
  chmod a+rwx $screendir
fi

while [ /bin/true ]
do
  screencapture -Smx $screendir/capture-$current.png

  current=$(( $current + 1 ))

  if [ $current -gt $keeparound ] ; then
    current=1
  fi

  sleep $delay

done

exit 0

I've tested this on my own system and it works great. I saved it as "capture.sh" and simply got it started with sh capture.sh &. Thereafter, every "delay" seconds the script took a screenshot, neatly squirreling away in /tmp/.captures for later analysis. If you're so inclined, you can modify it even further, but this coupled with you accessing the system remotely via either command line, ftp or Apple file sharing, you can easily see as many snapshot of what they're doing as you'd like. Remember, though, if you find anything incriminating you'll need to save it on your local system as everything is routinely overwritten as this script continues to chug along.

I should mention that there's an ethical consideration here too. Should you tell your children you are actively monitoring their computer usage? Should you tell them what you're doing and inform them that if they want to use the computer they need to agree to this relatively benign surveillance? This is obviously an even greater issue if you launched this on the computer of a spouse or colleague: then you're moving into 'spyware' and there might well be legal implications. In any case, with your children it's more ethical than legal, but you should still think carefully about whether you want to tell them or not.

Anyway, whether you go for the complicated script demonstrated here or just occasionally log in to their system, type "screencapture" and then open it remotely, you can see that there is indeed a solution to your problem on the Mac.



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

Hi Dave

how can I tell if someone is doing this to me ?
- or there is spyware loaded on my Mac

thanks
Scott

Posted by: Scott at April 23, 2007 9:44 AM

I use Apple Remote Desktop. A little on the pricey side. You can see what is going on at all times on multiple computers.
Thanks Dave for another great solution!

Posted by: Ana at May 14, 2007 10:41 AM

err i just watched a podcast called screencasts online and it had a pretty neat program on there for this that wasn't too pricey check it at: http://www.screencastsonline.com/sco/Shows/files/SCO0091-spyme2.html

(ps im not an advertiser for it i just thought that it would help)

MoJo JoJo

Posted by: Johnny at May 22, 2007 1:25 PM

Dave I manage to get the screenshot to work but when I tried typing in the more complicated scipt in the Terminal I get error messges.. cleary I am missing something. Do I need to prewrite the script somewhere and paste it? If so I am not sure what all in your posting is required and what is suggestions..

Posted by: memouse at February 27, 2008 2:17 PM

Why bother with this? Why not simply trust your kids? Chances are that if they are looking at pornography, they have questions...questions they clearly can't ask you because you wouldn't think they were hiding something from you, otherwise.

Posted by: Michael H at March 8, 2008 12:12 PM

I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]