ldapmodrdn(1ldap)


ldapmodrdn -- LDAP modify entry RDN tool

Synopsis

ldapmodrdn [-r] [-n] [-v] [-c] [-d debuglevel] [-D binddn] [-w passwd] [-W] [-h ldaphost] [-p ldapport] [-f file] [dn rdn]

Description

ldapmodrdn is a shell-accessible interface to the ldap_modrdn2(3ldap) library function.

It opens a connection to an LDAP server, binds, and modifies the RDN of entries. The entry information is read from standard input, from file through the use of the -f option, or from the command-line pair dn and rdn.

Options

-r
Remove old RDN values from the entry. Default is to keep old values.

-n
Show what would be done, but don't actually change entries. Useful for debugging in conjunction with -v.

-v
Use verbose mode, with many diagnostics written to standard output.

-c
Continuous operation mode. Errors are reported, but ldapmodify will continue with modifications. The default is to exit after reporting an error.

-d debuglevel
Set the LDAP debugging level to debuglevel.

-D binddn
Specify the Distinguished Name to be used in binding to the directory.

binddn should be a string-represented DN, as defined in RFC 1779 or its successor.

If a -D binddn option is not supplied, the command will take the binddn value from the LDAP_BINDDN_CHANGE environmental variable, if set. If LDAP_BINDDN_CHANGE specifies a null string, it is assumed that an anonymous bind is required.

If a -D option is not supplied, and LDAP_BINDDN_CHANGE is not used to specify the bind DN, the configuration file /etc/ldap_defaults will be examined for a default value to be used. If no default is supplied, a value of "" will be assumed.

-w passwd
Use passwd as the password for simple authentication.

-W
Read the password from the terminal. This is an alternative to supplying a password via the -w passwd option.

The password is prompted for in a non-echoing input mode. If ldapmodrdn has no controlling terminal, then the password will be read from standard input.

-h ldaphost
Specify the LDAP servers to connect to.

More than one server can be specified, in which case the servers are tried in the order specified, stopping with the first one to which a successful connection is made.

The servers can be specified either as hostnames or as dotted strings giving IP addresses.

A server port may be specified along with the server names or addresses by using the notation servername:portnumber or serverIPaddr:portnumber. If a port number is not explicitly specified for the particular server, a default port (as described for the -p option) is used.

If a null string is supplied, the local host is assumed. See the -p option for how the local port is selected.

If no -h option is supplied, the command will take the ldaphost value from the LDAP_HOST environmental variable, if this is present.

If no -h option is supplied, and LDAP_HOST is not set, then the configuration file /etc/ldap_defaults will be examined for a default value to be used.

If no default is supplied, a value of "", implying the local host, will be assumed.

-p ldapport
Specify the TCP port number to connect to (using the notation server:portnumber), if not specified via the -h option.

If no port number is explicitly supplied, the default LDAP port is assumed.

-f file
Read the entry modification information from file instead of from standard input or the command-line.

Input format

If the command-line arguments dn and rdn are given, rdn will replace the RDN of the entry specified by the DN, dn.

Otherwise, the contents of file (or standard input if no -f option is given) should consist of one or more entries.

   Distinguished Name (DN) 
   Relative Distinguished Name (RDN) 
One or more blank lines may be used to separate each DN/RDN pair.

Exit codes

Exit status is 0 if no errors occur. Errors result in a non-zero exit status and a diagnostic message being written to standard error.

Examples

Assume the file /tmp/entrymods has the following contents:
   cn=Modify Me, o=University of Michigan, c=US 
   cn=The New Me 
In that case, the following command will change the RDN of the ``Modify Me'' entry from ``Modify Me'' to ``The New Me'' and the old cn, ``Modify Me'' will be removed:

ldapmodify -r -f /tmp/entrymods

References

Intro(3ldap), ldapadd(1ldap), ldapdelete(1ldap), ldapmodify(1ldap), ldap_modrdn2(3ldap), ldapsearch(1ldap)

Kille, S., A String Representation of Distinguished Names, RFC 1779, ISODE Consortium, March 1995.


30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.