Delete an LDAP object using ldapmodify
Using ldpamodify to manipulate a directory server from the command line enables rapid changes (quicker than loading a GUI in some cases) and allows commands to be scripted for automation.
Any recipe with the word delete in the title must be used with caution. Please backup your directory server before doing this.
To delete an object, you must know it's distinguished name (dn). Consider the following object to be deleted:
uid:qmchenry, ou=people, dc=tech-recipes, dc=com
ldpamodify takes commands from the standard input. These commands are in a format called LDIF (lightweight directory interchange format). Once you start ldapmodify and authenticate, it will expect LDIF input without prompting you. The LDIF commands to delete the above object is:
Bind password: <enter your Directory Manager password>
dn: uid:qmchenry, ou=people, dc=tech-recipes, dc=com
changetype: delete
After the LDIF code, there are two blank lines. The first carriage return after the changetype line ends the actions on the current object. A status line will indicate the results of the action indicating success or pointing to the cause of failure. The second carraige return ends the LDIF file and will terminate the ldapmodify command.
The -D "cn=Directory Manager" option in the ldapmodify command line specifies the LDAP entity to bind to the directory as to make the change. Directory Manager is typically a special entity that exists outside of the directory server. The distinguished name of any entity within the directory with authority to make the desired change can be substituted. Without the -w option, ldapmodify will prompt you for the password of the entity specified with -D. The parameter following -w is interpreted as the password. Be careful using the -w password option from the command line as this could save the password in clear text in a shell history file or make it visible with a ps command. If you use ldapmodify from a shell script and include the password, make sure the file is not readable by everyone.
Note: this command syntax has been validated with the ldapmodify command in Solaris against the SunONE Directory Server.
Also see ...
H3MySQL includes a nifty feature that lets you select only rows 1 10, 11 20, or any set you want. Microsoft SQL Server does not include this feature. This recipe will show you how to mimic the same feature easily without stored procedures./H3PMicrosoft's T SQL includes the TOP syntax, which al
H3How to find the system language of a server running SQL2000 using a SQL statement./H3PI recently had a client who was having problem with date format in SQL2000 after moving from a UK based server to a German one. In order to check that the database was set to the correct language locale, ru
H3Run the following code in SQL Server 2000 Query Analyzer to return the Version and Service pack useful if you're having problems on a server and don't know if you're running the latest patches or not./H3Pdiv class="code" br /SELECT SERVERPROPERTY&40;'productversion'&41;, SERVERPROPE
