mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Mark Craig
01.07.2015 3b574cd1ee8b7536278db5241e8aef5155e371d3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ! CCPL HEADER START
  !
  ! This work is licensed under the Creative Commons
  ! Attribution-NonCommercial-NoDerivs 3.0 Unported License.
  ! To view a copy of this license, visit
  ! http://creativecommons.org/licenses/by-nc-nd/3.0/
  ! or send a letter to Creative Commons, 444 Castro Street,
  ! Suite 900, Mountain View, California, 94041, USA.
  !
  ! You can also obtain a copy of the license at
  ! trunk/opendj/legal-notices/CC-BY-NC-ND.txt.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! If applicable, add the following below this CCPL HEADER, with the fields
  ! enclosed by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CCPL HEADER END
  !
  !      Copyright 2015 ForgeRock AS.
  !
-->
<refsect1 xmlns="http://docbook.org/ns/docbook"
          version="5.0" xml:lang="en"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://docbook.org/ns/docbook
                              http://docbook.org/xml/5.0/xsd/docbook.xsd">
 <title>Examples</title>
 
 <para>
  The following example demonstrates use of the command
  to add an entry to the directory.
 </para>
 
 <screen>
$ <userinput>cat newuser.ldif</userinput>
<computeroutput>dn: uid=newuser,ou=People,dc=example,dc=com
uid: newuser
facsimileTelephoneNumber: +1 408 555 1213
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
givenName: New
cn: New User
cn: Real Name
telephoneNumber: +1 408 555 1212
sn: Jensen
roomNumber: 1234
homeDirectory: /home/newuser
uidNumber: 10389
mail: newuser@example.com
l: South Pole
ou: Product Development
ou: People
gidNumber: 10636</computeroutput>
 
$ <userinput>ldapmodify -p 1389 -a -f newuser.ldif \
 -D uid=kvaughan,ou=people,dc=example,dc=com -w bribery</userinput>
<computeroutput>Processing ADD request for uid=newuser,ou=People,dc=example,dc=com
ADD operation successful for DN uid=newuser,ou=People,dc=example,dc=com</computeroutput>
 </screen>
 
 <para>
  The following listing shows a UNIX shell script that adds a user entry.
 </para>
 
 <programlisting language="shell">
#!/bin/sh
#
# Add a new user with the ldapmodify utility.
#
 
usage(){
        echo "Usage: $0 uid firstname lastname"
        exit 1
}
[[ $# -lt 3 ]] &amp;&amp; usage
 
LDAPMODIFY=/path/to/opendj/bin/ldapmodify
HOST=opendj.example.com
PORT=1389
ADMIN=uid=kvaughan,ou=people,dc=example,dc=com
PWD=bribery
 
$LDAPMODIFY -h $HOST -p $PORT -D $ADMIN -w $PWD -a &lt;&lt;EOF
dn: uid=$1,ou=people,dc=example,dc=com
uid: $1
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: $2 $3
givenName: $2
sn: $3
mail: $1@example.com
EOF
 </programlisting>
 
 <para>
  The following example demonstrates adding a Description attribute
  to the new user's entry.
 </para>
 
 <screen>$ <userinput>cat newdesc.ldif</userinput>
<computeroutput>dn: uid=newuser,ou=People,dc=example,dc=com
changetype: modify
add: description
description: A new user's entry</computeroutput>
 
$ <userinput>ldapmodify -p 1389 -f newdesc.ldif \
 -D uid=kvaughan,ou=people,dc=example,dc=com -w bribery</userinput>
<computeroutput>Processing MODIFY request for uid=newuser,ou=People,dc=example,dc=com
MODIFY operation successful for DN uid=newuser,ou=People,dc=example,dc=com</computeroutput>
 </screen>
 
 <para>
  The following example demonstrates changing the Description attribute
  for the new user's entry.
 </para>
 
 <screen>
$ <userinput>cat moddesc.ldif</userinput>
<computeroutput>dn: uid=newuser,ou=People,dc=example,dc=com
changetype: modify
replace: description
description: Another description</computeroutput>
 
$ <userinput>ldapmodify -p 1389 -f moddesc.ldif \
 -D uid=kvaughan,ou=people,dc=example,dc=com -w bribery</userinput>
<computeroutput>Processing MODIFY request for uid=newuser,ou=People,dc=example,dc=com
MODIFY operation successful for DN uid=newuser,ou=People,dc=example,dc=com</computeroutput>
 </screen>
 
 <para>
  The following example demonstrates deleting the new user's entry.
 </para>
 
 <screen>$ <userinput>cat deluser.ldif</userinput>
<computeroutput>dn: uid=newuser,ou=People,dc=example,dc=com
changetype: delete</computeroutput>
 
$ <userinput>ldapmodify -p 1389 -f deluser.ldif \
 -D uid=kvaughan,ou=people,dc=example,dc=com -w bribery</userinput>
<computeroutput>Processing DELETE request for uid=newuser,ou=People,dc=example,dc=com
DELETE operation successful for DN uid=newuser,ou=People,dc=example,dc=com</computeroutput>
 </screen>
</refsect1>