Normalize winbind sambaSidEntry with uids from Linux

From Notes

Jump to: navigation, search
for i in $(cat /tmp/ldap.user.list)
do
  wbinfo -n ${i}
  if [ $? -lt 1 ]
  then
    SAMBASID=$(wbinfo -n ${i} | awk '{print $1}')
    LINUXUID=$(ldapsearch -x -H ldaps://ldap-server.example.com/ uid=${i} uidNumber -LLL | grep uidNumber | awk '{print $2}')
    echo "dn: sambaSID=${SAMBASID},ou=Idmap,dc=example,dc=com" >> sambasidupdate.ldif
    echo "changetype: modify" >> sambasidupdate.ldif
    echo "replace: uidnumber" >> sambasidupdate.ldif
    echo "uidnumber: ${LINUXUID}" >> sambasidupdate.ldif
    echo >> sambasidupdate.ldif
  fi
done
Personal tools