Posted on 08-19-2015 06:29 AM
I need to change the local admin account's name and password. What is the best practice for this? I was thinking about creating a policy with a new local admin account with the new account name and new password. Once that has been pushed out and verified I would create a policy to delete the old local admin account. Is this the best option? Any issues I should watch out for?
Posted on 08-19-2015 07:17 AM
You could write a script (or package a script if that's your thing) that makes the new account via dscl, then searches for the existing account and deletes it if found, moving its existing home drive to the new account's if you were interested in saving anything like that.
This a snippet of a script I use to create an admin account:
AdminAccount="YourAccount"
AdminPassword="YourPassword"
dsclPath="/Users/"$AdminAccount
dscl . -create $dsclPath
dscl . -create $dsclPath UserShell /bin/bash
dscl . -create $dsclPath RealName $AdminAccount
dscl . -create $dsclPath UniqueID 490
dscl . -create $dsclPath PrimaryGroupID 1000
dscl . -create $dsclPath NFSHomeDirectory '/var/.'$AdminAccount
createhomedir -c > /dev/null
dscl . -passwd $dsclPath $AdminPassword
dseditgroup -o edit -a $AdminAccount -t user admin