Adding users to the LDAP server
Learn how to add an exemplary test_ldap
user on the LDAP server. These
steps are required only if LDAP users are not already present and you want to create a new
one.
Procedure
- Create a
ldif
file at any location, as in the following example:root@LDAP_SERVER:~#cat test_ldap.ldif dn: uid=test_ldap,ou=users,dc=somedomain,dc=com uid: test_ldap cn: test_ldap objectClass: account objectClass: posixAccount objectClass: top loginShell: /bin/bash uidNumber: 5036 gidNumber: 3002 homeDirectory: /mnt/blumeta0/home/test_ldap gecos: test_ldap dn: cn=bluusers,ou=groups,dc=somedomain,dc=com changetype: modify add: memberuid memberuid: test_ldap memberuid: uid=test_ldap,ou=users,dc=somedomain,dc=com
- Add the LDAP user:
where:root@LDAP_SERVER:~# ldapadd -h localhost -p 389 -D cn=admin,dc=somedomain,dc=com -w adminpass -c < test_ldap.ldif
- -D
- Specifies distinguished name.
- -w
- Specifies the password associated with the DN.
adding new entry "uid=test_ldap,ou=users,dc=somedomain,dc=com" modifying entry "cn=bluusers,ou=groups,dc=somedomain,dc=com"
- Add password for the user:
where:ldappasswd -h localhost -p 389 -D cn=admin,dc=somedomain,dc=com -w adminpass -S "uid=test_ldap,ou=users,dc=somedomain,dc=com" -s netezzaips
- -S
- Specifies the user to change the password for. If you do not use
-s <password>
option to specify the password, the user will be prompted for new password at their first login. - -s
- Specifies a new password for the user.
- Verify if the user is added
successfully:
The output follows:root@LDAP_SERVER:~#ldapsearch -x -b "dc=somedomain,dc=com" | grep test_ldap
memberUid: test_ldap memberUid: uid=test_ldap,ou=users,dc=somedomain,dc=com # test_ldap, users, somedomain.com dn: uid=test_ldap,ou=users,dc=somedomain,dc=com uid: test_ldap cn: test_ldap homeDirectory: /mnt/blumeta0/home/test_ldap gecos: test_ldap