Limit the number of Users a Reseller can create


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » DirectAdmin » Custom Scripting

Limit the number of Users a Reseller can createLast Modified: Dec 3, 2012, 2:13 pm
If you want to cap the number of Users created by a Reseller, you can use the user_create_pre.sh to do so.
In this example, we'll see a maximum number of 10 Users for a Reseller, but you can change this number as desired.

1) Create the following file:

/usr/local/directadmin/scripts/custom/user_create_pre.sh

In that script, add the code:

#!/bin/sh

MAX_USERS=10

if [ "$usertype" != "user" ]; then
    exit 0;
fi

#obtains the exact number of domains on the system right now.  The tally is delayed, and cannot be used.
CURRENT=`wc -l /usr/local/directadmin/data/users/$creator/users.list | awk '{print $1;}'`

if [ "$CURRENT" -ge "$MAX_USERS" ]; then
      echo "Maximum number of Users  ($MAX_USERS) have already been created.  Cannot create any more."
      exit 1;
fi
exit 0;


2) chmod the script to 755:

chmod 755 /usr/local/directadmin/scripts/custom/user_create_pre.sh


 
Related Helpfiles
Using domain_create_pre.sh to limit the number of domains allowed on a server

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST