Skip to content
Snippets Groups Projects
Select Git revision
  • github
  • master default protected
  • 133-fail2ban-page
  • reorganisation
  • 16-maintenace-service
  • 11-fail2ban
  • 6-monit-update
  • 7-dolibarr-fail2ban
  • 6-surveillance-interne-des-serveur
  • test-glpi
  • 2-migrate-to-phpfpm
  • jessie
12 results

installNextcloud.env

Blame
  • create_mass_primtux_users.sh 910 B
    #!/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