How to change key data in a plist file.

jzhaoprosper
New Contributor

Hi All,

Anyone know how to change a data key in a plist file? I am trying to change the ShadowHashData key in the user's plist file in terminal. So for example:

ShadowHashData = ( <1111 11111 1111>
)

and I want to change it to

ShadowHastHdata = ( <22222 22222 2222 2222>
).

Anyone know the syntax on performing this task?

3 REPLIES 3

thoule
Valued Contributor II

You can change data using the defaults command.

defaults write File.PLIST key value

If adding a new key, you must specify the type.

or you can use plistbuddy command line. An other alternative is to use xcode.

I'm a bit concerned about what you are trying to accomplish and if that's something you should be changing, but I'll trust you know what you are doing.

jzhao
New Contributor

@thoule

I tried that and also tried the "dscl . -change" but it is not working. I'm trying to write a shell script that I can push out to change all the admin password. Instead of putting the password in the shell script as plain text I want to use the Hash password.

thoule
Valued Contributor II

Oh! yeah, you don't want to do that via dscl or defaults. Your JSS can do that under Policies, create an account, or change password. Another option is to use the CreateUserPKG which builds a pkg (installer) that creates a user. You can distribute that via a policy. https://github.com/MagerValp/CreateUserPkg