#!/bin/bash DIR=`dirname $0` usage(){ echo "Usage $0 names.txt" echo "Reads a list of name corresponding to some ldap users" echo "and run $DIR/create_primtux_user.sh on each of them" } if [ -z "$1" ] then usage exit 1 fi if [ ! -f "$1" ] then echo "$1 is not a file" usage exit 1 fi rm -f users.txt . /etc/slis/slis.conf while read first last level do uid=`ldapsearch -x cn="$first $last" | grep "^uid:" | cut -d ' ' -f 2` $DIR/create_primtux_user.sh $uid $level # set initial password echo "dn: uid=$uid,ou=People,$LDAP_BASE_DN" > $$.ldiff echo "changetype: modify" >> $$.ldiff echo "replace: userPassword" >> $$.ldiff echo "userPassword: $uid" >> $$.ldiff ldapmodify -x -D "cn=$LDAP_ADMIN_RDN,$LDAP_BASE_DN" -w $LDAP_ADMIN_PW -f $$.ldiff rm $$.ldiff echo -e "$uid\n$uid" | smbpasswd -s -U $uid echo $uid >> users.txt done < $1