User and Group Management in ldap through command line

Create a new user :

# ldapadduser george example

This will create a user with uid george and set the user’s primary group (gid) to example

It gives error
Cannot resolve group example to gid : not found

Error solved
First create group then add user in it

Create group:

# ldapaddgroup qa

Add user to group:

# ldapadduser george qa

Change password of user:

# ldapsetpasswd george
Changing password for user uid=george,ou=People,dc=example,dc=com
New Password: 
New Password (verify):

Delete user:

# ldapdeleteuser george

Delete group:

# ldapdeletegroup qa

Add user to group:

# ldapaddusertogroup navdeep telephonedirectory

Delete user from group:

# ldapdeleteuserfromgroup george qa

Terminal screen while performing operations

meow@meow-Ideapad-Z570:/etc/ldapscripts$ sudo ldapadduser george qa
Successfully added user george to LDAP
Successfully set password for user george
meow@meow-Ideapad-Z570:/etc/ldapscripts$ sudo ldapsetpasswd george
Changing password for user uid=george,ou=People,dc=navdeep,dc=bagga
New Password: 
Retype New Password: 
Successfully set password for user uid=george,ou=People,dc=navdeep,dc=bagga
meow@meow-Ideapad-Z570:/etc/ldapscripts$ sudo ldapdeleteuser george
Successfully deleted user uid=george,ou=People,dc=navdeep,dc=bagga from LDAP
meow@meow-Ideapad-Z570:/etc/ldapscripts$ sudo ldapadduser navdeep qa
Successfully added user navdeep to LDAP
Successfully set password for user navdeep
meow@meow-Ideapad-Z570:/etc/ldapscripts$ sudo ldapaddgroup telephone directory
Error adding group telephone to LDAP
meow@meow-Ideapad-Z570:/etc/ldapscripts$ sudo ldapaddgroup telephonedirectory
Successfully added group telephonedirectory to LDAP
meow@meow-Ideapad-Z570:/etc/ldapscripts$ sudo ldapaddusertogroup navdeep telephonedirectory
Successfully added user navdeep to group telephonedirectory
meow@meow-Ideapad-Z570:/etc/ldapscripts$ sudo ldapdeleteuserfromgroup george qa

1 thought on “User and Group Management in ldap through command line”

  1. I m unable to add a group to the ldap server.I m getting an error like this.

    Error adding group atg to LDAP

    Could u pls help me in finding out the solution plzzz…..

Leave a Reply

Your email address will not be published. Required fields are marked *