Revision of Create local user accounts from Thu, 08/13/2009 - 22:53
Here is a simple script to create a local user account, this script is designed with the idea of it being in an educational environment, so if you decide to use make sure to tweak it to your needs. I have tested it in mass in OS X 10.5.3 and 10.5.5 (several thousand clients) and it works great.
Here it is!
#!/bin/sh#you can fill in the blanks below and remove the pounds for varibale usage or manually input the data#Long Name: Student#Short Name: student#Password: passworddscl . -create /Users/studentdscl . -create /Users/student UserShell /bin/bashdscl . -create /Users/student RealName "Student"dscl . -create /Users/student UniqueID 505dscl . -create /Users/student PrimaryGroupID 20dscl . -create /Users/student NFSHomeDirectory /Local/Users/studentdscl . -passwd /Users/student passworddscl . -create /Users/student dsAttrTypeNative:_writers_hint: Typical passworddscl . -create /Users/student dsAttrTypeNative:_writers_LinkedIdentity: studentdscl . -create /Users/student dsAttrTypeNative:_writers_passwd: passworddscl . -create /Users/student dsAttrTypeNative:_writers_realname: studentdscl . -create /Users/student dsAttrTypeNative:_writers_UserCertificate: student
Now, if you wish to use varibales to create several local user accounts remove the pounds fromthe variables and alter the script accordingly. This is a standard local user account, you may also want to write in variables for the UniqueID (UID) for the users as well if you are going to create multiple. Anything over UID 500 is reserved for local user accounts and anything over 1000 is reserved for Directory (network) accounts. You can alter this script accordingly to match your needs, but if you are going to create massive Directory Accounts I recommend a third party Application to import them called Passenger.
Here is a script I use as a start up script using the Casper Suite. This script uses the JAMF binary, so if you are not running casper it does not work.
#!/bin/bash #use casper binary to create local user account for just in case #input user account info below between the quotes user="" longname="" password="" #creating a loop to see if user is currently installed, if not will continue, if #local user account is detected, process will hault to not overwrite the user account #and possibly destroy any data for legacy support listuser=`ls -al /Users | grep $user -c` if [ $listuser -eq 0 ] then /usr/sbin/jamf createAccount -username $user -realname “$longname” -password $password –home /Users/$user else echo "local account detected, exiting" fi exit done 0 #this will be unique to every building.
- Login to post comments
