#!/bin/sh # #ADMINDN="cn=admin,dc=unanleon,dc=edu,dc=ni" BASEDN=`cat /etc/ldap/ldap.conf |\ while read TOKEN PARAM BASURA; do if [ "$TOKEN" == "BASE" ]; then echo $PARAM; exit ; fi done` LDAPHOST=`cat /etc/ldap/ldap.conf |\ while read TOKEN PARAM BASURA; do if [ "$TOKEN" == "HOST" ]; then echo $PARAM; exit ; fi done` # admin dn MBOX=$1 PASS=$2 if [ -z "$MBOX" ]; then read -p "Introducir cuenta: " MBOX fi if [ -z "$PASS" ]; then read -p "Introducir contraseņa: " PASS fi if [ -z "$BASEDN" ]; then read -p "Introducir BaseDN: " BASEDN fi if [ -z "$ADMINDN" ]; then ADMINDN="cn=admin,"$BASEDN fi CRYPT=$(/usr/sbin/slappasswd -c '$1$%.8s' -h {crypt} -s $PASS) ldapmodify -x -D "$ADMINDN" -W -h $LDAPHOST <