View Single Post
  #1  
Old 3rd November 2009, 14:31
CMPJeff CMPJeff is offline
Junior Member
 
Join Date: Nov 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default LDAP add User script

Hi,

I've been trying to creat a user with the following script :

#!/bin/bash

#This Script adds a LDAP USER With a Zarafa Account

rm /tmp/ldapadduser.ldiff

PATH="/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/usr/lib/java/jre/bin"

# Variables
USERNAME=$1
EMAILADRESS=$2
FNAME=$3
LNAME=$4
ALIAS=$5
ADMIN=$6

#
echo dn: uid=$USERNAME,ou=Users,dc=company,dc=nl >> /tmp/ldapadduser.ldiff
echo objectClass: posixAccount >> /tmp/ldapadduser.ldiff
echo objectClass: top >> /tmp/ldapadduser.ldiff
echo objectClass: inetOrgPerson >> /tmp/ldapadduser.ldiff
echo objectClass: zarafa-user >> /tmp/ldapadduser.ldiff
echo objectClass: qmailUser >> /tmp/ldapadduser.ldiff
echo gidNumber: 65534 >> /tmp/ldapadduser.ldiff
echo loginShell: /none >> /tmp/ldapadduser.ldiff
echo givenName: $FNAME >> /tmp/ldapadduser.ldiff
echo sn: $LNAME >> /tmp/ldapadduser.ldiff
echo displayName: $FNAME $LNAME >> /tmp/ldapadduser.ldiff
echo uid: $USERNAME >> /tmp/ldapadduser.ldiff
echo homeDirectory: /none >> /tmp/ldapadduser.ldiff
echo mail: $EMAILADRESS >> /tmp/ldapadduser.ldiff
echo zarafaAccount: 1 >> /tmp/ldapadduser.ldiff
echo zarafaQuotaOverride: 0 >> /tmp/ldapadduser.ldiff
echo zarafaSharedStoreOnly: 0 >> /tmp/ldapadduser.ldiff
echo zarafaAdmin: 0 >> /tmp/ldapadduser.ldiff
echo zarafaQuotaHard: 1000 >> /tmp/ldapadduser.ldiff
echo zarafaQuotaSoft: 900 >> /tmp/ldapadduser.ldiff
echo zarafaQuotaWarn: 800 >> /tmp/ldapadduser.ldiff
echo cn: $LNAME $LNAME >> /tmp/ldapadduser.ldiff
echo uidNumber: 30266 >> /tmp/ldapadduser.ldiff

And after this script i perform a ldapadd to add the user...

BUT ! i have to have a unique uidNumber... Anyone ideas on how to do so ??


thnx in advance


Jeffrey
Reply With Quote
Sponsored Links