SRD

openldap user

SRD
Dec 19th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. OpenLDAP: 2.4.43
  2.  
  3. I loaded the slapd.ldif config.
  4. $ sudo slapadd -F /etc/openldap/slapd.d -n 0 -l slapd.ldif
  5.  
  6. Then loaded an admin and users with the file contents below ...
  7. $ sudo slapadd -F /etc/openldap/slapd.d -v -l 1 init.ldif
  8.  
  9. --- init.ldif ---
  10. ## build the root node.
  11. dn: dc=my,dc=domain,dc=org
  12. objectClass: dcObject
  13. objectClass: organization
  14. dc: my domain
  15. o: domain
  16.  
  17. dn: cn=manager,dc=my,dc=domain,dc=org
  18. objectClass: organizationalRole
  19. cn: admin
  20. description: LDAP Admin
  21.  
  22. ## build the users ou.
  23. dn: ou=users,dc=my,dc=domain,dc=org
  24. ou: users
  25. objectClass: organizationalUnit
  26. description: domain users
  27.  
  28. ## build the groups ou.
  29. dn: ou=groups,dc=my,dc=domain,dc=org
  30. ou: groups
  31. objectClass: organizationalUnit
  32. description: domain groups
  33.  
  34. --- file end ---
  35.  
  36. Started slapd.
  37. Tested with ...
  38. $ ldapsearch -x -b 'dc=my,dc=domain,dc=org' '(objectclass=*)'
  39.  
  40. ... which returned the following ...
  41.  
  42. ---- output ----
  43. # extended LDIF
  44. #
  45. # LDAPv3
  46. # base <dc=my,dc=domain,dc=org> with scope subtree
  47. # filter: (objectclass=*)
  48. # requesting: ALL
  49. #
  50.  
  51. # my.domain.org
  52. dn: dc=my,dc=domain,dc=org
  53. dc: domain
  54. objectClass: dcObject
  55. objectClass: organization
  56. o: MyDomain
  57.  
  58. # manager, my.domain.org
  59. dn: cn=manager,dc=my,dc=domain,dc=org
  60. objectClass: organizationalRole
  61. cn: admin
  62. description: LDAP Admin
  63.  
  64. # users, my.domain.org
  65. dn: ou=users,dc=my,dc=domain,dc=org
  66. ou: users
  67. objectClass: organizationalUnit
  68.  
  69. # groups, my.domain.org
  70. dn: ou=groups,dc=my,dc=domain,dc=org
  71. ou: groups
  72. objectClass: organizationalUnit
  73.  
  74. # search result
  75. search: 2
  76. result: 0 Success
  77.  
  78. # numResponses: 5
  79. # numEntries: 4
  80. ---- output end ----
  81.  
  82. Stopped the slapd process.
  83. Loaded a user with this command, using the following ldif.
  84. $ sudo slapadd -F /etc/openldap/slapd.d -v -l james.ldif
  85.  
  86. ---- james.ldif ---
  87. # user primary group
  88. dn: cn=james,ou=groups,dc=my,dc=domain,dc=org
  89. cn: james
  90. objectClass: top
  91. objectClass: posixGroup
  92. gidNumber: 1000
  93.  
  94. # user account
  95. dn: uid=james,ou=users,dc=my,dc=domain,dc=org
  96. cn: James
  97. uid: james
  98. uidNumber: 1000
  99. gidNumber: 1000
  100. sn: James
  101. homeDirectory: /home/james
  102. objectClass: top
  103. objectClass: person
  104. objectClass: organizationalPerson
  105. objectClass: inetOrgPerson
  106. objectClass: posixAccount
  107. objectClass: shadowAccount
  108. loginShell: /bin/bash
  109. gecos: james
  110. userPassword: {crypt}x
  111. shadowLastChange: 0
  112. shadowMax: 0
  113. shadowWarning: 0
  114. ---- user file end ----
  115.  
  116. Started slapd process again and performed the following search.
  117.  
  118. # extended LDIF
Advertisement
Add Comment
Please, Sign In to add comment