Created
May 4, 2017 18:35
-
-
Save pythoninthegrass/334d2a3e3295a49976eaf999444a1641 to your computer and use it in GitHub Desktop.
create user on mac os x with dscl command
This file contains hidden or 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
# for pair programming setup a user on your machine | |
#INPUT | |
USERNAME="tmuxpair" | |
# COMPUTE | |
LATEST_ID=$(dscl . -list /Users UniqueID | awk '{print $2}' | sort -ug | tail -1) | |
USER_ID=$((LATEST_ID+1)) | |
# CREATE with sudo | |
dscl . -create /Users/$USERNAME | |
dscl . -create /Users/$USERNAME UserShell /bin/bash | |
dscl . -create /Users/$USERNAME RealName $USERNAME | |
dscl . -create /Users/$USERNAME UniqueID "$USERID" | |
# in staff group | |
dscl . -create /Users/$USERNAME PrimaryGroupID 20 | |
dscl . -create /Users/$USERNAME NFSHomeDirectory /Users/$USERNAME | |
# no need for password. we'll ssh with key | |
#dscl . -passwd /Users/$USERNAME $PASSWD | |
# find my public ip | |
dig +short myip.opendns.com @resolver1.opendns.com | |
# use github pub key for user | |
# ls-pair download the public keys to the pair user before creating a user | |
curl https://github.com/$githubuser.keys > public_keys/$githubuser.pub | |
# resources | |
https://gist.github.com/marksim/5785406/raw/c986c8882661a47d422d899d89c3fe44c7979f96/pair-session.sh | |
https://github.com/livingsocial/ls-pair | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment