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

Prevent adding certain email names using the all_pre.sh script

If you wish to prevent users from adding email names like root, webmaster, postmaster, use the following code in your:
/usr/local/directadmin/scripts/custom/all_pre.sh
script:

#!/bin/sh

blockaccount()
{
   if [ "$user" = "$1" ] || [ "$newuser" = "$1" ]; then
      echo "You cannot create an account named $1";
      exit 1;
   fi
}

if [ "$command" = "/CMD_EMAIL_POP" ]; then
   if [ "$action" = "create" ] || [ "$action" = "modify" ]; then
      blockaccount root;
      blockaccount webmaster;
      blockaccount postmaster;
   fi
fi
exit 0;


Was this answer helpful?

Also Read