[K12OSN] SMB/LDAP Groups Issue

cliebow at downeast.net cliebow at downeast.net
Sat Jul 16 19:54:50 UTC 2005


something like this should add all eisting Staff users to Staff..any
thoughts how many diffewrent groups would need to have users added??? chuck

#!/bin/bash

#ldapsearch -LL -x -h localhost -b
"ou=Staff,ou=People,dc=ehs,dc=ellsworthschools,dc=org" -D
"cn=root,dc=ehs,dc=ellsworthschools,dc=org" -w "St3rnm4n" -s sub
"(objectClass=sambaSamAccount)" | grep gecos > /root/ld
#this searches the staff are for users and sends results to /root/ld2
ldapsearch -LL -x -h localhost -b
"ou=Staff,ou=People,dc=ehs,dc=ellsworthschools,dc=org" -D
"cn=root,dc=ehs,dc=ellsworthschools,dc=org" -w "ourpw" -s sub
"(objectClass=sambaSamAccount)" | grep sn | cut -f2 -d ":" >ld2
#this stars with existing Staff ldif and add all users from ld2
cat <<EOF>> ld4.ldif
dn: cn=Staff, ou=Group, dc=ehs,dc=ellsworthschools,dc=org
sambaSID: S-1-5-21-3781802711-710701864-1625986258-2050
cat << EOF >> /root/ld4.ldif
gidNumber: 2050
memberUid: dsearchfield
memberUid: krichter
memberUid: abatson
memberUid: blong
memberUid: csargent
memberUid: taustin
memberUid: lfuller
memberUid: bhomich
memberUid: hcasey
memberUid: jnewett
memberUid: lcartwright
memberUid: mdayton
memberUid: kmckenney
memberUid: lrudolph
sambaGroupType: 2
objectClass: posixGroup
objectClass: sambaGroupMapping
cn: Staff
EOF


cat /root/ld2|while read item ; do
echo "memberUid: $item > ld4.ldif
done
ldapadd -x h localhost -D "cn=root,dc=ehs,dc=ellsworthschools,dc=org" -w
"ourpw" -f
/root/ld4.ldif

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





More information about the K12OSN mailing list