How to Add Users/Group/OU in OpenLdap

 ADDIGN  AN ORGANIZATIONAL UNIT (OU)

  1. 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

 

  1. 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

#####################

 

  1. 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

  1. 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

  1. 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

#######################

 

  1. 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

#########################

  1. 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

  1. 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

  1. 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

Popular posts from this blog

How To Enable SSH Login for root user in RHEL9/CENTOS9

HOW TO INSTALL AND CONFIGURE KEEPALIVE BETWEEN TWO SERVERS ON CENTOS/RHEL

Installing K8s cluster in your local environment

USEFULL COMMANDS TO MANAGE ZIMBRA USERS AND SERVICES

File Permissions in Linux

HOW TO INSTALL AND CONFIGURE HAPROXY ON RHEL/CENTOS