openldap/ldapuseradd.sh

raw link view readme
1 #+
2 #+ copyright (c) david betz
3 #++ might suck, but it seems to work
4 #+
5
6 max_uid=$(getent passwd | cut -d: -f3 | sort -n | tail -n1)
7 new_uid=$(($max_uid + 1))
8 sed "/userPassword:/d;/^ /d;s/David Betz/John Doe/;s/davidbetz/$1/g;s/uidNumber: 4000/uidNumber: $new_uid/g" ~/user_template.ldif
9
10 #usage:
11 # ~/ldapuseradd.sh user02 "John Doe" > ~/user02.ldif
12 # ldapadd -x -D "cn=Admin,dc=example,dc=net" -f ~/user02.ldif -w mypassword
13