Created
June 11, 2012 18:05
-
-
Save murphybytes/2911668 to your computer and use it in GitHub Desktop.
create a dummy account for Mac OSX
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
| cp $HOME/.bash_profile $HOME/bash_profile.$(date +%Y%m%d.%s).backup | |
| grep -q DUMMY_ACCOUNT= $HOME/.bash_profile || echo "export DUMMY_ACCOUNT=${DUMMY_ACCOUNT}" >> $HOME/.bash_profile | |
| last_uid=$(dscl . -list /Users UniqueID | awk '$2 > 500 { print $2 }' | sort -ug | tail -n1) | |
| unique_uid=`expr $last_uid + 1` | |
| echo "Creating user $DUMMY_ACCOUNT with UID $unique_uid" | |
| dscl . -create /Users/$DUMMY_ACCOUNT | |
| dscl . -create /Users/$DUMMY_ACCOUNT UserShell /bin/bash | |
| dscl . -create /Users/$DUMMY_ACCOUNT RealName 'dummy account' | |
| dscl . -create /Users/$DUMMY_ACCOUNT UniqueID $unique_uid | |
| dscl . -create /Users/$DUMMY_ACCOUNT PrimaryGroupID 1000 | |
| dscl . -create /Users/$DUMMY_ACCOUNT NFSHomeDirectory /Users/$DUMMY_ACCOUNT | |
| dscl . -passwd /Users/$DUMMY_ACCOUNT 'dummy' | |
| dscl . append /Groups/com.apple.access_ssh user $DUMMY_ACCOUNT | |
| dscl . append /Groups/com.apple.access_ssh groupmembers `dscl . read /Users/$DUMMY_ACCOUNT GeneratedUID | cut -d " " -f 2` | |
| echo "Creating local ucp directory" | |
| mkdir -pv $HOME/.ucp | |
| chown -Rv $USER $HOME/.ucp | |
| echo "Setting up $DUMMY_ACCOUNT directories" | |
| mkdir -pv /Users/$DUMMY_ACCOUNT/.ssh | |
| mkdir -pv /Users/$DUMMY_ACCOUNT/.ucp | |
| cat $HOME/.ssh/id_rsa.pub >> /Users/$DUMMY_ACCOUNT/.ssh/authorized_keys | |
| chown -Rv $DUMMY_ACCOUNT /Users/$DUMMY_ACCOUNT | |
| echo "Creating softlink to ucp in dummy" | |
| if [ ! -h /Users/${DUMMY_ACCOUNT}/ucp ]; then | |
| ln -s "$(pwd)/src/ucp" /Users/${DUMMY_ACCOUNT}/ucp | |
| fi | |
| echo "All done" | |
| echo "You will want to set DYLD_LIBRARY_PATH in your .bash_profile to reference boost libraries, udt libraries and cryptopp libraries" | |
| echo "" | |
| echo "Password for $DUMMY_ACCOUNT is dummy" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment