[K12OSN] ldapsearch Samba/LDAP Question

cliebow at downeast.net cliebow at downeast.net
Fri Jul 29 11:34:04 UTC 2005


ldapsearch -LL -x -h localhost -b "ou=$ldfile,ou=People,$suffix" -D "$dn"
-w "$pw" -s sub "(objectClass=sambaSamAccount)" | grep sn: | cut -f2 -d
":"|cut -c2- >$ldfolder/$ldfile

here is an ldapsearch to pick put all sn names from a group and send them
yo a file

you can then add a MemberUid to a group ldif
cat <<EOF>> $ldfolder/$ldfile.ldif
dn: cn=$ldfile, ou=Group, dc=ehs,dc=ellsworthschools,dc=org
sambaSID: S-1-5-21-3781802711-710701864-1625986258-2050
gidNumber: 2050
EOF
cat $ldfolder/$ldfile|while read item ; do 
echo "memberUid: $item" >> ld4.ldif
cat <<EOF>> ld4.ldif
sambaGroupType: 2
objectClass: posixGroup
objectClass: sambaGroupMapping
cn: $ldfile
EOF
##############################################################
echo $name > $ldfolder/$ldfile

then use an ldapmodify to overwrite the sisting staff group entry

#ldapmodify -x -h localhost -D "$dn" -w "$pw" -f
/#root/ld4.ldif

---------------------------------------------
This message was sent from Downeast.Net.
http://ellsworthme.com/





More information about the K12OSN mailing list