/build/static/layout/Breadcrumb_cap_w.png

Mac Script to change Administrator password

I am looking for a UNIX/Mac command line to run on all my Macs to change the Administrator password.

0 Comments   [ + ] Show comments

Answers (3)

Posted by: krimkus 14 years ago
Senior Yellow Belt
0
Did you find a script for this? Probably by now, but if not, I have one.
Posted by: knowmad 14 years ago
Senior Yellow Belt
0
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.

Comments:
  • 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 - cmora 10 years ago
Posted by: MacDude 9 years ago
Fifth Degree Brown Belt
0

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

 

 

#!/bin/bash

 

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

 

password="your_password"

 

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

status=$?

 

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."

fi

 

exit $status

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

Don't be a Stranger!

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

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ