Tags

, ,

To add a user create an ldif file as below
[root@host1 sherlock]# cat sherlock.ldif

dn: uid=sherlock,ou=People,dc=test,dc=domain,dc=com

uid: sherlock

cn: sherlock

objectClass: account

objectClass: posixAccount

objectClass: top

objectClass: shadowAccount

shadowMin: 0

shadowMax: 99999

shadowWarning: 7

loginShell: /bin/bash

uidNumber: 2016

gidNumber: 2016

homeDirectory: /home/sherlock

gecos: Holmes Shelrock

shadowLastChange: 16610

userPassword: {SSHA}gqTy2GiM0mLO3rNuLfrHJHZaOD7/6TOk

 

Use the below command for SSHA password generation 

 #slappasswd -h {SSHA} -s password

Add the user with 

 #ldapadd  -H ldaps://host.test.domain.com -D uid=sherlock,ou=People,dc=test,dc=domain,dc=com” -W -f sherlock.ldif

 To delete the ldapuser 

 

#ldapdelete  -H ldaps://host.test.domain.com -D uid=sherlock,ou=People,dc=test,dc=domain,dc=com -W “uid=anoopk,ou=People,dc=test,dc=domain,dc=com”

 

To search a user

#ldapsearch -H ldaps://test.dev.cluster.host.com -D uid=anoopk,ou=people,dc=dev,dc=cluster,dc=host,dc=com -W |grep -i -20 Holmes

To change password of user sherlock

#ldappasswd -H test.dev.cluster.host.com -D uid=anoopk,ou=people,dc=dev,dc=cluster,dc=host,dc=com -W -S “uid=sherlock,ou=people,dc=dev,dc=cluster,dc=host,dc=com”

OR

#ldappasswd -D uid=anoopkum,ou=people,dc=dlx,dc=idc,dc=ge,dc=com -W -s rajesh@123 uid=sherlock,ou=people,dc=dev,dc=cluster,dc=host,dc=com

 

 

 

 

Advertisements