Create Admin account for 10.11 .sh file

KyleEricson
Valued Contributor II

What commands do I use for this. I tried this and it seems to hang on the NetInstall.

Has this changed in 10.11 to different commands?

!/bin/sh

. /etc/rc.common
dscl . create /Users/administrator
dscl . create /Users/administrator RealName "Administrator"
dscl . passwd /Users/administrator password
dscl . create /Users/administrator UniqueID 501
dscl . create /Users/administrator PrimaryGroupID 80
dscl . create /Users/administrator UserShell /bin/bash
dscl . create /Users/administrator NFSHomeDirectory /Users/administrator
dscl / -append /Groups/admin GroupMembership administrator
cp -R /System/Library/User Template/English.lproj /Users/administrator
chown -R administrator:staff /Users/administrator

Read My Blog: https://www.ericsontech.com
15 REPLIES 15

dan-snelson
Valued Contributor II

We use something along these lines to create a hidden admin account:

/usr/sbin/sysadminctl -addUser $adminAccount -fullName $adminAccount -UID 498 -password $adminPassword -home "/private/var/${adminAccount}" -admin

jonscott
New Contributor

side query: does anyone know what 'jamf createAccount' does under the hood? It's definitely worked for me on 10.11.

nwiseman
Contributor

Take a look at this. https://github.com/MagerValp/CreateUserPkg

The app allows you to set everything the way you want it and then just installs as a .pkg

KyleEricson
Valued Contributor II

@nwiseman This doesn't work in 10.11

Read My Blog: https://www.ericsontech.com

nwiseman
Contributor

@kericson Interesting...I'm using it for our 10.11.x images without issue.

KyleEricson
Valued Contributor II

@nwiseman When you try to add this .pkg file this is the error I get.
bd7e831336364a5baca9274eb09486ed

Read My Blog: https://www.ericsontech.com

nwiseman
Contributor

@kericson Where are you trying to add it? I may be misunderstanding.

What I'm doing is creating the pkg and placing it in CasperAdmin. From there I set it to install on the boot drive after imaging, then add it to all of my image configurations. So far I haven't had any issues with this, but I may not be actually doing what you want done.

KyleEricson
Valued Contributor II

I have to use Apple System Image Utility :( so this is where I'm trying to put this.

Read My Blog: https://www.ericsontech.com

nwiseman
Contributor

Ahh...Ok...Sorry for dragging you down the rabbit hole then.

KyleEricson
Valued Contributor II

@dan.snelson How would I make this not hidden?

Read My Blog: https://www.ericsontech.com

dan-snelson
Valued Contributor II

@kericson Try using a UID greater than 501 (making sure to not duplicate any existing UIDs).

gachowski
Valued Contributor II

Kyle,

I tried adding stuff to the SIU when making a netinstall image, in my beta testing of X.10.11 and somethings were working and some were not.. also I wanted to a erase and auto install and that didn't work reliably either so I gave up.

I got X.10.11.3 to erase auto install however It's not working in X.10.11.4 ...

long way of saying that I think that parts SIU are not 100% reliable.

C

bentoms
Release Candidate Programs Tester

@kericson why do you have to use SIU? & what's the end goal?

If you've paid for Casper, I'm wondering why using SIU over Casper Imaging.

msample
Contributor II

@kericson Kyle one of the best resources I've found for creating a hidden Administrator account (under 500) is, "CreateUserPkg." nwiseman is spot on! https://github.com/MagerValp/CreateUserPkg

KyleEricson
Valued Contributor II

@bentoms I only paid for composer we use AirWatch instead. CreateUserPkg. doesn't work in SIU neither does any other .sh scripts for some reason

Read My Blog: https://www.ericsontech.com