Ldap
Revision as of 22:07, 4 July 2007 by 192.168.2.113 (talk)
Change varables to suite your domain.
/usr/share/openldap/migration/migrate_common.ph
Convert local users to ldap users.
/usr/share/openldap/migration/migrate_passwd.pl /temp/user /temp/user.ldif
Import users.
ldapadd -x -D "cn=Manager,dc=halfface,dc=se" -w secret -f /temp/user.ldif -c
Example ldif to add user.
dn: uid=bjorklun,ou=people,dc=halfface,dc=se uid: bjorklun cn: Andreas Bjorklund objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword: {crypt}$1$encryptedpasswordheretowork shadowLastChange: 13080 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 501 gidNumber: 501 homeDirectory: /home/bjorklun gecos: Andreas Bjorklund
Adding local groups.
cat /etc/group | sort -k3 -t : -n | tail -22 | head -20 > /temp/group /usr/share/openldap/migration/migrate_group.pl /temp/group /temp/group.ldif ldapadd -x -D "cn=Manager,dc=halfface,dc=se" -w secret -f /temp/group.ldif -c
Adding passwd and group.
dn: ou=people,dc=halfface,dc=se objectclass: organizationalUnit ou: people dn: ou=group,dc=halfface,dc=se objectclass: organizationalUnit ou: group
Organization Units.
dn: ou=Friends,dc=halfface,dc=se ou: Friends objectClass: top objectClass: organizationalUnit description: Members of Friends dn: ou=Work,dc=halfface,dc=se ou: Work objectClass: top objectClass: organizationalUnit description: Members of Work
ldap attribute.
dn: dc=halfface,dc=se dc: halfface description: Root LDAP entry for halfface.se objectClass: dcObject objectClass: organizationalUnit ou: rootobject
dn: ou=People, dc=halfface,dc=se ou: People description: All people in organisation objectClass: organizationalUnit
dn: dc=halfface,dc=se objectclass: dcObject objectclass: organization o: halfface dc: halfface dn: cn=Manager,dc=halfface,dc=se objectclass: organizationalRole cn: Manager
ldapadd -x -D "cn=Manager,dc=halfface,dc=se" -w secret -f /tmp/newentry -v
ldapsearch -x -b 'dc=halfface,dc=se' '(objectclass=*)'