Industry guru Dave Taylor offers tech support on technical and business topics, including iPhone, iPod, Microsoft Windows, Sony PSP, cellphones, online advertising, CSS, Web design, business, Unix, Linux, SEO, Mac OS X, and shell script programming.     


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.


More Useful Mac OS X Help Articles:
✔   Audacity can't find LAME library, I can't save Mp3?
Hey Dave. I read your article Audacity can't save mp3 audio files and am still puzzled because I downloaded the LAME Mp3 converter...
✔   How to remove Dashboard as a "space" in Mac OS X Spaces?
I'm a big fan of the Spaces utility in Mac OS X that lets me have multiple virtual screens [see Set Up Mac...
✔   Best place to buy a cheap MacBook laptop?
Hi Dave. I am looking for two gently used MacBook laptops for my teen daughters. Personal computers would greatly facilitate their studies as...
✔   File too big error copying to USB flash drive on my Mac?
I'm baffled. I have a 16GB Kingston USB flash drive that I use on my Mac system and I'm trying to copy a...
✔   Stealth image capture photo from webcam on my Mac?
Someone sneaks into my cubicle while I'm at lunch and takes candy out of my desk. Petty, but stupid too. I want to...

Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
    Enter your name: and your email addr:  





Categorized: Mac OS X Help   (Article 7310, Written by )
Tagged: mac os x, monitoring, screen capture, screenshot, surveillance
Previous: How do I enable trackpad tap clicking on my MacBook Pro?
Next: How much RAM does my Windows PC have?




Reader Comments To Date: 10

Scott said, on April 23, 2007 9:44 AM:

Hi Dave

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

thanks
Scott

Ana said, on May 14, 2007 10:41 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!

Johnny said, on May 22, 2007 1:25 PM:

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

memouse said, on February 27, 2008 2:17 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..

Michael H said, on March 8, 2008 12:12 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.

keylogger's fan said, on March 28, 2009 1:25 AM:

You can try to use this invisible Mac Keylogger called "Perfect Key logger for Mac" - see www.blazingtools.com/mac_keylogger.html

It offers good value for the price.

irisa said, on September 16, 2009 9:32 PM:

can someone tell me is there some spy program for mac that can be installed remotely (i mean from distance via attachment)

need to check on my husband's mac.. usually he leaves is at work,
but i guess there is something in his life that he started to hide from me : (

thanks

regards

macspy001 said, on September 27, 2009 7:39 PM:

Hi, how can I get this script to automatically run every time a certain person logs in? It would have to silently run in the background with no way to detect it.

So far, it works great but every time the computer reboots, one must run "sh capture.sh &" in the terminal all over again.

Dave Taylor said, on September 27, 2009 10:18 PM:

Welll.... I'm a bit uncomfortable with this, but will go this far: you can run a script in a loop grepping the output of "who" to find when someone logs in, then trigger another script...

Martin said, on October 30, 2011 10:00 AM:

Here's my solution based on your work:

#/bin/sh

maindir=$HOME"/.hiddendir/"
delay=300

while [ /bin/true ]
do
mnth=`date +%Y_%m_%b`
day=`date +%d_%a`
tme=`date +%Hh%Mm`

screendir=$(echo $maindir/$mnth/$day|sed 's/\/\//\//g')

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

screencapture -Smx -tjpg $screendir/$tme.jpg
sleep $delay

done
exit 0

I used this solution to wrap it into a hidden .app which is suitable as a startup item:
http://hints.macworld.com/article.php?story=20050517210406483

Lion users can add scripts directly to their startup items.

Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!

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











I will never send you any unsolicited email. Ever.






Check This Out Too...

 
Look for Answers
Need Help? Ask Dave Taylor!


Follow Me on Pinterest

Find Me on Google+
ADT on G+
© 2002 - 2013 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. Further, 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. My lawyer says "Thanks".
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.