3

In attempting to automate setting up firmware passwords through DeployStudio, I accidentally wrote a bad script loosely based off Dash's post Setting a firmware password that did not work as intended.

#!/bin/sh    
diskutil mount Recovery\ HD & wait
hdiutil attach -quiet -nobrowse /Volumes/Recovery\ HD/com.apple.recovery.boot/BaseSystem.dmg & wait
OLDPASSWORD= ""
CONFIRMPASSWORD= "password"
/Volumes/OS\ X\ Base\ System/Applications/Utilities/Firmware\ Password\ Utility.app/Contents/Resources/setregproptool -m command -p $CONFIRMPASSWORD -o $OLDPASSWORD
diskutil unmount force Recovery\ HD & wait
echo "New Firmware Password is Set"

If you can tell already, when setting the variables for OLDPASSWORD and CONFIRMPASSWORD, I should not have added that extra space because I got "command not found" errors.

However, I ran the script through DeployStudio (Postponed execution not checked) and a password WAS set. I just don't know what it is. I tried "password" and empty password. Does anyone have an idea what it could be? The only this else I could do is send the macbook to Apple Repair.

1
  • kenorb was only the post's editor. The script was written by Dash. – grg Feb 6 '17 at 23:11
2

Since OLDPASSWORD and CONFIRMPASSWORD are both unset, the command your script executed was:

/Volumes/OS\ X\ Base\ System/Applications/Utilities/Firmware\ Password\ Utility.app/Contents/Resources/setregproptool -m command -p -o

I don't know for certain (and I'm not about to test it), but I'd expect that this has taken "-o" as an argument to the "-p" option, and hence set the firmware password to "-o".

BTW, in addition to removing the spaces after the "=" in assignments, you should also double-quote all references to variables, like this:

/Volumes/OS\ X\ Base\ System/Applications/Utilities/Firmware\ Password\ Utility.app/Contents/Resources/setregproptool -m command -p "$CONFIRMPASSWORD" -o "$OLDPASSWORD"

This will prevent the shell from doing weird things with variables that contain spaces and/or wildcards, or are blank (like OLDPASSWORD in your script).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .