Поэтому для миграции нужен скрипт, который будет проверять, есть ли дубликаты пользователей и будет выводить их список в файл.
Даже не знаю с чего начать, буду благодарен за любую помощь
Сравнивать необходимо поле UID
#! /usr/bin/python # Authentication ldap_dn = "cn=qwerty" ldap_pwd = "tivoli" ldap_server = "" sameb_uid = "sec_master" sameb_pwd = "tivoli" # The part of the LDAP tree where you expect users ldap_base = "ou=users,O=qwert,C=RU" # The part of the LDAP tree where the SAMeb # configuration is located ldap_sameb_base = "secAuthority=qwerrty" # Internal configuration ldap_user_file = "ldap_users" from subprocess import call call("C:\OpenLDAP\ClientTools\ldapsearch -LLL -D " + ldap_dn + " -w " + ldap_pwd + " -b " + ldap_base + " -h " + ldap_server + " objectclass=inetOrgPerson uid >" + ldap_user_file, shell=True) ldap_users = open(ldap_user_file, "r") k=0; p=0; for line in ldap_users: if len(line) > 1: p=0; if (k==1): uid = line[5:-1] print dn print uid call("pdadmin -a " + sameb_uid + " -p " + sameb_pwd + " user import " + uid + " " + dn, shell=True); call("pdadmin -a " + sameb_uid + " -p " + sameb_pwd + " user modify " + uid + " account-valid yes ", shell=True); k=0; p=1; if (k==0): if (p==0): dn = line[4:-1] k=k+1;