forked from mkristian/dm-ldap-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ldap-commands.txt
17 lines (12 loc) · 1023 Bytes
/
ldap-commands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# populate ldap with basic data
ldapadd -x -w behappy -c -D "cn=admin,dc=example,dc=com" < test.ldif
# search the whole domain
ldapsearch -x -w behappy -c -D "cn=admin,dc=example,dc=com" -b 'dc=example,dc=com'
# search people
ldapsearch -x -w behappy -c -D "cn=admin,dc=example,dc=com" -b 'ou=people,dc=example,dc=com'
#search groups
ldapsearch -x -w behappy -c -D "cn=admin,dc=example,dc=com" -b 'ou=groups,dc=example,dc=com'
# printout delete commands for all people
ldapsearch -x -w behappy -c -D "cn=admin,dc=example,dc=com" -b 'ou=people,dc=example,dc=com' "uid=*" | grep ^uid: | sed -e "s/^.....//" -e 's/$/,ou=people,dc=example,dc=com"/' -e 's/^/-x -w behappy -c -D "cn=admin,dc=example,dc=com" "uid=/' | xargs -L 1 echo ldapdelete
# all groups
ldapsearch -x -w behappy -c -D "cn=admin,dc=example,dc=com" -b 'ou=groups,dc=example,dc=com' "cn=*" | grep ^cn: | sed -e "s/^....//" -e 's/$/,ou=groups,dc=example,dc=com"/' -e 's/^/-x -w behappy -c -D "cn=admin,dc=example,dc=com" "cn=/' | xargs -L 1 echo ldapdelete