10/09/2009 15736 views
I am looking for a UNIX/Mac command line to run on all my Macs to change the Administrator password.
0 Comments   [ + ] Show comments


Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

All Answers

Did you find a script for this? Probably by now, but if not, I have one.
Answered 11/13/2009 by: krimkus
Senior Yellow Belt

How about passwd or you can do it on 10.5 and higher like this:

/usr/bin/dscl . -passwd /Users/[user short name] [password]

but then don't forget to also change the keychain password to match

security set-keychain-password -o [oldpass] -n [NEWPASS]

but to my knowledge that must be done when logged in as the user... also this requires a lot of sending passwords over the network or hardcoding them into your scripts..... you may want to look into other options or be REAL careful about dumping that script when your done.
Answered 04/09/2010 by: knowmad
Senior Yellow Belt

  • The first command worked for me. However, the second one required the location of the keychain. It looks like:
    sudo dscl . -passwd /Users/test opassword
    sudo security set-keychain-password -o npassword -p opassword /users/test/Library/Keychains/login.keychain
This content is currently hidden from public view.
Reason: Removed by member request For more information, visit our FAQ's.

Another script note that it will have teh password in cleartext.





#for when you need to change the local admin (ladmin) accounts




/usr/bin/dscl . passwd /Users/ladmin "$password"



if [ $status == 0 ]; then

echo "Password was changed successfully."

elif [ $status != 0 ]; then

echo "An error was encountered while attempting to change the password. /usr/bin/dscl exited $status."



exit $status

Answered 05/01/2014 by: MacDude
Fifth Degree Brown Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login