Last active
September 29, 2023 16:54
-
-
Save RichardFevrier/6e515aaaadc5d3b72906be6f23689867 to your computer and use it in GitHub Desktop.
macOS cli create admin user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: | |
# sudo ID=1000 NAME=richard PASSWORD=azerty /bin/bash -c "$(curl -fsSL https://gist.github.com/RichardFevrier/6e515aaaadc5d3b72906be6f23689867/raw/macOS_cli_create_admin_user.sh)" | |
dscl . -create /Groups/$NAME | |
dscl . -create /Groups/$NAME gid $ID | |
dscl . -create /Users/$NAME | |
dscl . -create /Users/$NAME UserShell /bin/zsh | |
dscl . -create /Users/$NAME RealName $NAME | |
dscl . -create /Users/$NAME UniqueID $ID | |
dscl . -create /Users/$NAME PrimaryGroupID $ID | |
dscl . -create /Users/$NAME NFSHomeDirectory /Users/$NAME | |
dscl . -passwd /Users/$NAME $PASSWORD | |
dscl . -append /Groups/admin GroupMembership $NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment