Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Create completely hidden accounts in 10.5 and 10.4.11' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create completely hidden accounts in 10.5 and 10.4.11
Authored by: foilpan on Mar 05, '08 02:49:50PM
i modified your makeuser function to provide a little feedback and to create a home in /var/home so the user directory is a little out of the way. most apps will work fine without a homedir, but it's easy enough to create one, especially if the user won't be storing much of anything there. i run this as root via single user mode or with sudo, so all the sudo lines are unnecessary in the script. the UID is hardcoded in my edited version, too. thanks for putting this together!

makeUser ()
	/bin/echo "creating admin user account…"
	/usr/bin/dscl localhost create $PATH/Users/$USERNAME
	/usr/bin/dscl localhost create $PATH/Users/$USERNAME PrimaryGroupID 0
	/usr/bin/dscl localhost create $PATH/Users/$USERNAME UniqueID 444
	/usr/bin/dscl localhost create $PATH/Users/$USERNAME UserShell /bin/bash
	/usr/bin/dscl localhost passwd $PATH/Users/$USERNAME $PASSWORD
	/usr/bin/dscl localhost append $PATH/Groups/admin GroupMembership $USERNAME
	/usr/bin/dscl localhost create $PATH/Users/$USERNAME NFSHomeDirectory /var/home/$USERNAME
	/bin/echo "creating new admin account homedir…"
	/bin/mkdir -p /var/home/$USERNAME
	/usr/bin/ditto -rsrc -V /System/Library/User\ Template/English.lproj/ /var/home/$USERNAME/
	/usr/sbin/chown -Rf $USERNAME:admin /var/home/$USERNAME
	/bin/echo "confirming what we just did…"
	/bin/ls /var/home/$USERNAME/
	/usr/bin/id $USERNAME
	/bin/echo "if that looks good, we're all set."

[ Reply to This | # ]