Q: How can I change the keychain password through Terminal?
Hey all,
so here's what I'm trying to do: my organization has a relatively small network, yet it's too large to manually perform changes to each workstation. We are preparing to change all the local administrator passwords, and we would like to do this by sending UNIX commands via Apple Remote Desktop (yes, we're aware of the security implications and will be sure to remove the script afterwards). I've been able to successfully change the password for the local admin account using the following command:
/usr/bin/dscl . -passwd /Users/Admin oldpassword newpassword
Doing it this way, however, causes there to be a disparity between the login password and the keychain password. Is there a command that I can send through UNIX to also change the keychain password? Thanks.
Posted on Nov 12, 2015 9:02 AM
Try the security set-keychain-password command. Probably...
security set-keychain-password -o oldpwd -p newpwd /Users/{UserShortNameHere}/Keychains/login.keychain
Try that on a scratch keychain, first.
Apple has some resources available that might be interesting to you (and if you've not already found these), such as the advanced shell scripting document or the old command-line administration manual, or the command-line section of the more recent Server Tools help.
Entirely FWIW, the ARD forum isn't the best spot for OS X command-line administration questions, BTW — probably one of the server forms would be a better spot, since these are generic OS X Server commands. From what I can tell of it, there aren't all that many folks that lurk around here.
Posted on Nov 12, 2015 11:26 AM