Changing all Users under a given creator to a specific package


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


Top Level » DirectAdmin

Changing all Users under a given creator to a specific packageLast Modified: Jul 17, 2019, 4:34 am
DirectAdmin does not have a bulk "Move Users to package" (for now), but a simple script could be used to accomplish things, in combination with a simple "save" through DA.  Let's assume assume the following variables:
Creator
Package to set

  1. First, we'd run this script, while modifying the variables as desired:

    #!/bin/sh
    CREATOR=admin
    TOPACKAGE=gold

    USERS=/usr/local/directadmin/data/users
    for u in `ls $USERS`; do
    {
           UCONF=$USERS/$u/user.conf
           C=`grep ^creator= $UCONF | cut -d= -f2`
           if [ "$C" != "$CREATOR" ]; then
                   continue;
           fi
           T=`grep ^usertype= $UCONF | cut -d= -f2`
           if [ "$T" != "user" ]; then
                   continue;
           fi
           perl -pi -e "s/^package=.*/package=${TOPACKAGE}/" $UCONF
    };
    done;
    exit 0;

  2. Save the script, chmod it to 755, and run it.  All Users below admin should now be set to gold.
  3. Lastly, we need to activate the actual numerical data form your gold package into the user.conf file.  For this, we login to DirectAdmin as admin, go to

    Reseller Level -> Manage User Packages -> gold -> Save

    which will go through all Users with this package and update them to these values.

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