Tue, 27 May 2008

12:41 PM - Adding Open Directory users in OS X

#!/bin/sh

# example
# 20 = staff group
# 7001 = available uid we know about
# adduser laffer1 7001 20 LucasHolt pass22 /Users/laffer1

user=$1
uid=$2
gid=$3
longname=$4
password=$5
homedir=$6

dscl localhost << EOF
cd /LDAPv3/127.0.0.1/Users
auth diradmin diradmin's_password_here
create $user
create $user UserShell /bin/bash
create $user UniqueID $uid
create $user PrimaryGroupID $gid
create $user RealName $longname
create $user NFSHomeDirectory $homedir
passwd $user $password
quit
EOF

0 comments