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
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.