How to Add Users/Group/OU in OpenLdap
ADDIGN AN ORGANIZATIONAL UNIT (OU)
- Create a
temporary file called users.ldif. (You can
delete this file once its content has been added to LDAP, so in this
example, we will create it in the /tmp folder.)
[root]# cd /tmp
[root]# vi users.ldif
2.Add these lines to users.ldif:
dn:
ou=Users,dc=acme,dc=com
objectClass:
organizationalUnit
ou: Users
- Add the contents
of users.ldif file to
LDAP.
[root]# ldapadd -f users.ldif -D cn=Manager,dc=acme,dc=com -w
p@ssw0rd
ADDING
USERS
#####################
- Create a
temporary file called bob.ldif. (You can
delete this file once its content has been added to LDAP, so in this
example, we will create it in the /tmp folder.)
[root]# cd /tmp
[root]# vi bob.ldif
- Add these lines
to bob.ldif:
dn: cn=Bob Jones,ou=Users,dc=acme,dc=com
cn: Bob Jones
sn: Jones
objectClass: inetOrgPerson
userPassword: p@ssw0rd
uid: bjones
- Add the contents
of bob.ldif file to
LDAP.
[root]# ldapadd -f bob.ldif -D cn=Manager,dc=acme,dc=com -w
p@ssw0rd
ADDING A GROUP
TO LDAP
#######################
- Create a
temporary file called engineering.ldif. (You can
delete this file once its content has been added to LDAP, so in this
example, we will create it in the /tmp folder.)
[root]# cd /tmp
[root]# vi engineering.ldif
2. Add
these lines to engineering.ldif:
dn:
cn=Engineering,ou=Users,dc=acme,dc=com
cn: Engineering
objectClass:
groupOfNames
member: cn=Bob
Jones,ou=Users,dc=acme,dc=com
3. Add the
contents of engineering.ldif file
to LDAP.
[root]# ldapadd -f engineering.ldif -D cn=Manager,dc=acme,dc=com
-w p@ssw0rd
ADDING A
USER TO GROUP
#########################
- Create a
temporary file called addUserToGroup.ldif. (You can
delete this file once its content has been added to LDAP, so in this example,
we will create it in the /tmp folder.)
[root]# cd /tmp
[root]# vi
addUserToGroup.ldif
- Add these lines
to addUserToGroup.ldif:
dn: cn=Engineering,ou=Users,dc=acme,dc=com
changetype: modify
add: member
member: cn=Al Smith,ou=Users,dc=acme,dc=com
- Now add the
contents of addUserToGroup.ldif file to
LDAP.
[root]# ldapadd -f addUserToGroup.ldif -D
cn=Manager,dc=acme,dc=com -w p@ssw0rd
Comments
Post a Comment