Create Local Admin Account Issue

Valued Contributor

I have AirWatch and I create an Admin Acount via ssh script. Everytime I log in with that account its a endless keychain pop-up need to repair the library. The also looks like it doesn't have rights to its own home folder. any thoughts?



Create Admin Account

dscl . -create /Users/administrator
dscl . -create /Users/administrator UserShell /bin/bash
dscl . -create /Users/administrator RealName "Administrator" dscl . -create /Users/administrator UniqueID "510"
dscl . -create /Users/administrator PrimaryGroupID 1000
dscl . -create /Users/administrator NFSHomeDirectory /Users/administrator
dscl . -passwd /Users/administrator P@ssW0rd!

dscl . -append /Groups/admin GroupMembership administrator

Read My Blog:

Valued Contributor II

Try adding code to create a home directory.

#Create Home Directory
dscl . create /Users/admin NFSHomeDirectory /Users/admin
cp -R /System/Library/User Template/English.lproj/ /Users/admin/
chown -R admin:staff /Users/admin/

Valued Contributor II

Also, I typically would set the PrimaryGroupID to 20 to make the user part of the built-in staff group.