Appendix D - Open LDAP Setup : Adding a User
  

Adding a User

Before we add a user, we first need to generate its password hash:
slappasswd -h {SHA} -s my_secret_password
 
yielding this result:
{SHA}M6XDJwA47cNw9gm5kXV1uTQuMoY=
 
We will use this result when creating our user file. Make the following file and name it add_user.ldif
dn: uid=john,ou=people,dc=test,dc=com
cn: John Doe
givenName: John
sn: Doe
uid: john
uidNumber: 5000
gidNumber: 10000
homeDirectory: /home/john
mail: john.doe@example.com
objectClass: top
objectClass: posixAccount
objectClass: shadowAccount
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
loginShell: /bin/bash
userPassword: {SHA}M6XDJwA47cNw9gm5kXV1uTQuMoY=
 
And add it by running:
ldapadd -x -D cn=admin,dc=test,dc=com -W -f add_user.ldif