Bulk User Adding For Qmail Toaster
Jump to navigation
Jump to search
Greetings, With help from the script PakOgah sent me I have created a bulk user adding script! It reads a text file which has entries like FIRSTNAME LASTNAME USERNAME And automatically adds the users in the text file, creates a comment field sets a default quota and password Suggestions are welcome. The script is attarched. Its still missing some functionality but its work in progress Kisakye ALex akisakye@ucu.ac.ug
#!/bin/sh # # BULK USER ADDING FOR QMAIL TOASTER # # Created after I ran into an issue of creating 20,000 users on my toaster! # Initial ideas come from a script that PakOgah "pakogah@pala.bo-tak.info" # helped me with. # Still very manual, but Work in Progress # # Suggestions to akisakye@ucu.ac.ug # # Change a few variables and you are good to go # # # Location of the users file # Rememeber that the users file is in the format # Firstname Lastname Username USERS_FILE="/path/to/file.txt" # The mail domain to which users are created # MAILDOMAIN="@domain.com" # the vadduser command QMAILADD="/home/vpopmail/bin/vadduser" # Select a default password for all users PASS="mypass" #Specify the Default Quota_in_bytes for your Users # 10 MB = 10 x 1024 x 1024 QUOTA="10485760" #Fun starts here No more variables to change below this line cat ${USERS_FILE} | \ while read FIRSTNAME LASTNAME USERNAME do echo "adding the user: $USERNAME" $QMAILADD -q $QUOTA -c "$FIRSTNAME $LASTNAME" $USERNAME$MAILDOMAIN $PASS done #