[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: delete/modify many users

Gary ,thank you very much.
Guess you forgot to reply to maillist,so I send it again in case some one
would be interested in this.

----- Original Message ----- 
From: "Tay, Gary" <Gary_Tay@platts.com>
To: <man@mentata.com>; "kakula" <lololo@seed.net.tw>
Sent: Tuesday, October 12, 2004 12:48 PM
Subject: RE: delete/modify many users

I scripted it, u may find more info:


Content of openldap_delete_Peoples.sh

#! /bin/sh
# openldap_delete_Peoples.sh
# Destructive script
# Never do deletion at LDAP Master Server
# Do deletion only at LDAP Slave Server
[ "`uname -n`" = "ldap1" ] && exit

# Un-Comment for RedHat
# Un-Comment for others
grep "^dn:" People.ldif | sed 's/^dn: //' >openldap_delete_Peoples.ldif
if [ -f mgr.pwd ]
   $BINDIR/ldapdelete -c -x -D "cn=Manager,dc=example,dc=com" -w `cat
mgr.pwd` -f openldap_delete_Peoples.ldif
   echo "mgr.pwd not found"
   echo "Please enter LDAP password for cn=Manager,dc=example,dc=com..."
   $BINDIR/ldapdelete -c -x -D "cn=Manager,dc=example,dc=com" -W -f

-----Original Message-----
From: owner-openldap-software@OpenLDAP.org
[mailto:owner-openldap-software@OpenLDAP.org] On Behalf Of Jon Roberts
Sent: Tuesday, October 12, 2004 11:27 AM
To: kakula
Cc: OpenLDAP-software@OpenLDAP.org
Subject: Re: delete/modify many users

kakula wrote:
> Hi
> I just want to know why  can't delete/modify many  entries at a time
> by using ldapdelete or ldapmodify. For example:I want to delete all
> users of one group,but I must indicate the certain uid .And you
> know,if having a lot of users,......again and again
> ldapdelete -x -D "cn=manager,dc=mydomain,dc=com"
> uid=userA,ou=groupA,dc=mydomain,dc=com  -W
> Or is there a way to do at a time?

Use ldapmodify with an LDIF like:

dn: uid=userA,ou=groupA,dc=mydomain,dc=com
changetype: delete

dn: uid=userB,ou=groupA,dc=mydomain,dc=com
changetype: delete

dn: uid=userC,ou=groupA,dc=mydomain,dc=com
changetype: delete


Hope that helps. Also hope that Kurt or whoever don't block me from the
mailing list anymore without at least telling me why.

Jon Roberts