OUD – Using ldif-modify


# Add a test user : 
 
$ $BIN_PATH/ldapmodify -p 1389 -D "cn=Directory Manager" -w Welcome1

dn: cn=User12,ou=People,dc=example,dc=com
changetype: add
objectclass:inetorgperson
sn: User
cn: Twelve
 
# Stop the server
 
$ $BIN_PATH/stop-ds 
 
# Import the Group having member in it. 
 
$BIN_PATH/import-ldif -a -r -l /add-group1.ldif -n userRoot 
 
$ cat > /add-group1.ldif
 
dn: cn=Group12, ou=Groups, dc=example,dc=com
cn: Group12
objectclass: top
objectclass: groupOfNames
ou: Groups
member: cn=User12,ou=People,dc=example,dc=com

# Start the server
 
$ $BIN_PATH/start-ds 
 
# Perform ldapsearch verification from group and member side : 
 
$BIN_PATH/ldapsearch -p 1389 -D "cn=Directory Manager" -w Welcome1 -b "dc=example,dc=com" "(cn=Group12)"
dn: cn=Group12,ou=Groups,dc=example,dc=com
member: cn=User12,ou=People,dc=example,dc=com
cn: Group12
ou: Groups
objectClass: groupOfNames
objectClass: top

$ $BIN_PATH/ldapsearch -p 1389 -D "cn=Directory Manager" -w Welcome1 -b "dc=example,dc=com" "(cn=User12)" isMemberOf
dn: cn=User12,ou=People,dc=example,dc=com
isMemberOf: cn=Group12,ou=Groups,dc=example,dc=com

# Stop the server 

$ $BIN_PATH/stop-ds 

# Import the group with no members :

cat > /add-group-no-members.ldif
dn: cn=Group13, ou=Groups, dc=example,dc=com
cn: Group13
objectclass: top
objectclass: groupOfNames
ou: Groups

# Import the group: 
$ $BIN_PATH/import-ldif -a -r -l /add-group13.ldif -n userRoot


# Start the server:

$ $BIN_PATH/stop-ds 

$ $BIN_PATH/ldapsearch -p 1389 -D "cn=Directory Manager" -w Welcome1 -b "dc=example,dc=com" "(cn=Group12)"
dn: cn=Group12,ou=Groups,dc=example,dc=com
cn: Group12
ou: Groups
objectClass: groupOfNames
objectClass: top

$ $BIN_PATH/ldapsearch -p 1389 -D "cn=Directory Manager" -w Welcome1 -b "dc=example,dc=com" "(cn=User12)" isMemberOf
dn: cn=User12,ou=People,dc=example,dc=com