Friday 20 April 2012

How to create ldap user in Linux LDAP Server

Lets see how to create ldap user in Linux LDAP Server

Step 1: Create a local user account named <sl092467> in LDAP Server

#useradd sl092467

Step 2 : Note down the details of the user using passwd file

#cat /etc/passwd | grep sl092467               (note down uid, gid etc)

Step 3 : create a file named <raja> and enter as below

dn: uid=sl092467,ou=People,dc=csscorp,dc=com
uid: sl092467
cn: sl092467
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {crypt}$1$QLoEkVTC$RHrUQKYbqtRi4cfoPtusT.
shadowLastChange: 15027
shadowMin: 1
shadowMax: 90
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 1014
gidNumber: 1014
homeDirectory: /home/sl092467

Step 4 : Save the file and execute the below command to add user sl092467 as ldap user

#ldapadd  -D "cn=Manager,dc=csscorp,dc=com"  -W -x  -f /home/venkat/ldap/raja

Step 5 : execute the below command to set ldap password for user sl092467

#ldappasswd -S -x -W -D "cn=Manager,dc=example,dc=com" "uid=sl092467,ou=People,dc=example,dc=com"

Enter ldap password for user and confirm the password. Then u will be prompted for ldap root password

Step 6 :  To add user sl092467 as a member of sladmin group. Open the <groupname>.ldif file

dn: cn=sladmin,ou=Group,dc=csscorp,dc=com
objectClass: posixGroup
objectClass: top
cn: sladmin
userPassword: {crypt}x
gidNumber: 1050
memberUid: sl000132
memberUid: sl005204
memberUid: sl005207
memberUid: sl005209
memberUid: sl005241
memberUid: sl005262
memberUid: sl007290
memberUid: sl088966
memberUid: sl089004
memberUid: sl005408
memberUid: css95891
memberUid: sl092467
memberUid: sl088735
memberUid: sl005539
memberUid: css05210

Step 7 : Add the user sl092467 as highlighted above and save the file

Step 8 : Execute the below command to add user sl092467 as member of sladmin group

#ldapmodify  -D "cn=Manager,dc=csscorp,dc=com"  -W -x  -f grp_modi.ldif

Step 9 : Login to linux server using ldap account credentials. when u login for the first time u will be prompted to change the password.







No comments:

Post a Comment