Artificial intelligent assistant

ldapdelete, want to remove all UID's of people OU, but preserve OU? With this cli: $ ldapdelete -ZZ -W -D "cn=Manager,dc=site,dc=fake" -r ou=People,dc=site,dc=fake I remove all UID's of People, but the problem is it also removes People OU. I know it's easy to recreate a empty OU, but I'd like to remove all UID's of People OU, but preserve the actual People OU?

Sorry for the delay, but I had to install and populate an LDAP server first to test the correct procedure. As `ldapdelete` reads the list of objects from STDIN if there are none presented on the command line (or in a file), you can use a pipe like


ldapsearch -ZZ -W -D 'cn=Manager,dc=site,dc=fake' \
-b 'ou=people,dc=site,dc=fake' -s one dn |\
grep dn: | cut -b 5- | ldapdelete -ZZ -W -D 'cn=Manager,dc=site,dc=fake'


This will ask you for the password twice; maybe you can use some other authentication method.

Instead of `-b ... -s one` you might have to define some other search base/scope/filter, depending on the directory structure.

I leave the part `grep dn: | cut -b 5- |` for those of you familiar to awk/sed/... any other constructs to optimize. I just like to keep things simple.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 1c5d04299a5f27d885a1c315079da143