Posted on 10-18-2018 09:47 PM
I want to create an account within the Macbook using JAMF policy > Script.
I've searched online some info, updated it with $4, $5, etc so that it fits JAMF Pro. But when I ran it, nothing happens.
Anyone got any suggestions?
#!/bin/bash username=$4 password=$5 adminRights=$6 dscl . -create /Users/$username dscl . -create /Users/$username UserShell /bin/bash dscl . -create /Users/$username RealName $username dscl . -create /Users/$username UniqueID "999" dscl . -create /Users/$username PrimaryGroupID 20 dscl . -create /Users/$username NFSHomeDirectory /Users/$username dscl . -passwd /Users/$username $password if [ "$adminRights" = "admin" ]; then dscl . -append /Groups/admin GroupMembership $username fi
Posted on 10-18-2018 09:53 PM
The account has been created :)
It's just that it didn't create a home directory. But I did find the account within System Preferences > Users.
I think I'm good now.
Posted on 10-18-2018 11:14 PM
Just to let you know hat DSCL is restricted under 10.14 so you may have some problems using that script
Posted on 10-19-2018 07:18 AM
I recommend using
sysadminctl in High Sierra and Mojave, otherwise you'll run into issues with secureToken and enabling FileVault.
dscl also seems to strip secureToken from users that already have it if using that command to reset the user's password in the future.
sudo sysadminctl -adminUser AdminUserHere -adminPassword AdminPasswordHere -addUser NewUserNameHere -fullName "Full Name Here" -password NewUserPasswordHere -admin
It auto sets the shell and UID, but you can specify those with additional flags. Check out
sysadminctl --usage There's a password passthrough option
- as well.
Posted on 10-19-2018 11:10 AM
why don't you use the function in the jamf binary it can create an account on the local machine
Posted on 10-19-2018 11:14 AM
It not very flexible and sometimes fails on new OS versions until Jamf fix it.
Use Greg Negale’s python script if you want to make users. It does direct Directory Service calls
Posted on 10-19-2018 11:24 AM