[Samba] Scripting the next UID/GID number to use

Rowland Penny rpenny at samba.org
Tue May 29 20:00:59 UTC 2018


On Tue, 29 May 2018 15:50:44 -0400
lingpanda101 via samba <samba at lists.samba.org> wrote:

> Hello,
> 
>      I'm developing a script to create a user and pass along all the 
> necessary unix attributes required. I'm successful except when I go
> to increment msSFU30MaxUidNumber or msSFU30MaxGidNumber. I'm not sure
> how to use ldbedit to script this process. Any guidance would be
> great. Thanks.
> 
> - James
> 
> 
> 

Something like this:

# UPDATE msSFU30MaxUidNumber/msSFU30MaxGidNumber
# Input : $1 $2
# $1: what to update (msSFU30MaxUidNumber or msSFU30MaxGidNumber)
# $2: Next Number
#
# Output : Nothing
_updatemax () {
echo "Updating $1"

newid="dn: CN=$domainNETBios,CN=ypservers,CN=ypServ30,CN=RpcServices,CN=System,$domainDN
changetype: modify
replace: $1
$1: $2"

echo "${newid}" | $LDBMODIFYBIN -H "$ldbdb" > /dev/null 2>&1
if [ $? != 0 ]; then
    echo "Error updating $1 in AD."
    exit 1
fi

echo "Successfully updated $1 in AD"
}

Rowland



More information about the samba mailing list