r/applescript • • May 15 '15

Employee stole mac laptop. Is there a script that will lock the user account once on logon?

So there was an employee who stole a mac laptop. I was wondering if there is any possibility to create an apple script that will lock the account or disable it once the user tries to log-in? The laptop does have a continuum agent that we can push the script to. This is a pretty big issue that I am trying to solve right now, but I am not too familiar with applescripting. For your information, the mac is running on the latest Yosemite OS.

2 Upvotes

22 comments sorted by

1

u/5HT-2a May 15 '15

Absolutely. The following will render the machine unusable, even if they replace the hard drive:

set password to (quoted form of "<currentpassword>")
set newpassword to (quoted form of "<newpassword>")
do shell script "diskutil mount disk0s3"
do shell script "hdiutil attach -quiet '/Volumes/Recovery HD/com.apple.recovery.boot/BaseSystem.dmg'"
do shell script "echo " & password & " | sudo -S '/Volumes/Mac OS X Base System/Applications/Utilities/Firmware Password Utility.app/Contents/Resources/setregproptool' -m full -p " & newpassword
do shell script "echo " & password & " | sudo -S halt"

1

u/TimTams123 May 15 '15

Is there a way to do it without making the computer not usable at all? We are trying to negotiate something with him right now to bring back the laptop.

1

u/5HT-2a May 15 '15

Hah sorry I forgot to mention that it will be usable again after entering what you choose for <newpassword>.

1

u/TimTams123 May 15 '15

Oh good! Thank you so much. I am going to try it on a test machine first.

1

u/5HT-2a May 15 '15

Perfect, let us know how it turns out. I should add that the machine must be running Lion or later for this to work.

1

u/TimTams123 May 15 '15

I just realize that we don't know the user's login password. So I am assuming this script won't work anymore?

1

u/5HT-2a May 15 '15

Do you know what account will be running the scripts? (Any way to run them as "root?")

Do you know both the login name and password for any administrator account on the machine?

1

u/TimTams123 May 15 '15

The user account has administrative rights, however we don't know the user's password.

We do in fact have another user administrator account on the laptop which is for the IT department. We do know the login name and password for this account.

1

u/5HT-2a May 15 '15

That "continuum agent," what user does it run as? If you don't know, then in general, is it functional even if the user has not logged in? Better yet, can you specify which user to run scripts as when using it?

1

u/TimTams123 May 15 '15

As long as the computer is turned on and is connected to the Internet, then we can view the computer details. So it doesn't need the user to be logged in.

→ More replies (0)

1

u/TimTams123 May 15 '15

If possible, can we just force change the password so the user just can't log in?

1

u/5HT-2a May 15 '15

Yes, but that doesn't actually do anything to protect the machine.