Modify Multiple Users

CrazyLane

Verified User
Joined
Dec 28, 2004
Messages
142
Is there a way to modify multiple users instead of editing each one?

i.e remove spamassassin, add suspend at limit etc.

Thanks!
 
interested aswell, specially when modify a package that would be automatic apply to each user that is using that package.
 
You could set up a bash script with perl regex I suppose, along the lines of:

Usage: script.sh <username>
Code:
#!/bin/sh
DIR=/usr/local/directadmin/data/users/$1.conf

if [ $# != 1 ]; then
        echo "Usage:";
        echo "$0 <username>";
        echo "you gave no username";
        exit 0;
fi

# turn Spamassassin off
perl -pi -e "s/SPAM=ON/SPAM=OFF/g" $DIR

etc

exit 0;

I'm no script king but thats off my head.......... John may suggest a safer/cleaner way
 
Last edited:
Hello,

Actually, what SeLLeRoNe mentioned already does happen.

If you have 10 users, and they all use the User Package "gold", then you'd need to only edit the "gold" pacakge, set it how you want, and DA will go through all Users on the system who use "gold" and update their user.conf values accordingly.

The catch is, if you've manually edited a User's settings, then he's no longer part of "gold".. and he becomes custom, so changing "gold" won't affect the User anymore.

Past that, I'd use a script, similar to what Peter mentioned. I tend to just write simple perl regex's to work right on the user.conf files.
eg: disable spam:
Code:
cd /usr/local/directadmin/data/users
perl -pi -e 's/spam=ON/spam=OFF/' *.user.conf
for example (of course, that's just a setting and hasn't actually "done" anything.. to really disable spam, you must delete the users user_prefs file. If you want to delete everyone's user_prefs file, type:
Code:
rm -f /home/*/.spamassassin/user_prefs
Each option in the user.conf may require some sort of action, which is why doing it through DA itself is usually better.. since DA does the action for you, as well as setting the user.conf file.

John
 
If you have 10 users, and they all use the User Package "gold", then you'd need to only edit the "gold" pacakge, set it how you want, and DA will go through all Users on the system who use "gold" and update their user.conf values accordingly.
So if I edit my packages, then all users under that package will have the new settings? If so, is there a way of disabling this, for example, existing customers are under their existing contract (and existing price), new users will obviously take out a new contract (and any new price) with any package settings that might've been changed. If these old customers want to upgrade/change to these new settings, we can set them manually. If you undstand where I'm coming from.
 
well if is not a feature you wanna offer to old customers too so yes, it will be a new package.. if was a feature of a single package so was a feature for every customer using that package...

am i wrong?
 
Back
Top