Add to Favourites Add to Favourites    Print this Article Print this Article

I need to run fix_da_user.sh for everyone based on the /etc/virtual/domainowners file

If you've managed to delete the contents of your /usr/local/directadmin/data/users directory, and you need to re-create them, you can use this guide.  Note that if you have bacukps, it may be easier to start over and just restore the backups, but if you want this surgical fix, you can still give it a try.

The fix_da_user.sh script will add any missing fields into the users data configs for DA.
The below script will run it for each user and each domain stored in the /etc/virtual/domainowners file (assuming you didn't delete that as well)
You'll need to make sure you /usr/local/directadmin/data/users directory is created and chowned to diradmin:diradmin.

Create a fix.sh script with the following contents, chmod the script to 755, then run it.
Running it on existing data shouldn't hurt things (in theory) as it only adds missing fields, and ignores fields that are not missing.

#!/bin/sh

while read line
do
     domain=`echo $line | cut -d: -f1`;
     user=`echo $line | cut -d  -f2`;

     echo "Fixing $domain for $user ...";

     /usr/local/directadmin/scripts/fix_da_user.sh $user user $domain

done < /etc/virtual/domainowners

Note that this will create all missing users with a default set of data, like unlimited limits, etc..  It will also create them with the "admin" account as their Reseller.  If you need to change the creator after, do so from:  Admin Level -> Move Users between Resellers.

Also, if any of the accounts created by fix_da_user.sh are actually Reseller accounts, you must upgrade them to Reseller accounts using the /usr/local/directadmin/scripts/user_to_reseller.sh script.

Was this answer helpful?

Also Read