Modifying multiple attributes in an entry from the command line
Steps
-
To locate a specific entry, run the
ldapsearchtool.Example:
$ bin/ldapsearch -h server.example.com -p 389 -D "cn=admin,dc=example,dc=com" \ -w password -b dc=example,dc=com "(uid=user.2004)" -
To change attributes from the command line, use the
ldapmodifycommand.-
Specify the modification using the
changetype:modifysubcommand. -
Specify the attributes to change using the
addandreplacesubcommand.Example:
In this example, we add the
postOfficeBoxattribute and change the mobile and telephone numbers of a specific user entry. ThepostOfficeBoxattribute must be present in your schema to allow the addition. The three changes are separated by a dash ("-").$ bin/ldapmodify -h server.example.com -p 389 -D "cn=admin,dc=example,dc=com" -w password dn: uid=user.2004,ou=People,dc=example,dc=com changetype: modify add: postOfficeBox postOfficeBox: 111 - replace: mobile mobile: +1 039 831 3737 - replace: telephoneNumber telephoneNumber: +1 097 453 8232
-
-
Process the request.
Choose from:
-
For Unix, enter
ctrl+dtwice.This is the Unix EOF escape sequence.
-
For Windows, enter
ctrl+z.
-