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

Comments

Please log in to comment

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

Answers

0
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

Please log in to comment
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.
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
Please log in to comment
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

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

Please log in to comment
Answer this question or Comment on this question for clarity

Share