Create multiple domain accounts with bash script
Hello
I am trying to create multiple accounts with a bash script that works fine my issue is it reads the domain user-names and passwords form a file but /scripts/wwwacct is reading the file and trying to add everything as the domains even the user and pass. Bellow is a copy of the script and the file and the output when I run the script.
Script
Domain, User, Pass File
Any help to fix this would be great I know its how I have them listed in the file that is the issue so my question is how do I fix it so wwwacct can read it properly?
#! /bin/bash
#make a file (/root/test1) which contains domain names, username and password.
for i in `cat /root/test1`
do
domain=`echo $i | cut -f1 -d:`
un=`echo $i | cut -f2 -d:`
pw=`echo $i | cut -f3 -d:`
/scripts/wwwacct $domain $un $pw 0
doneDomain, User, Pass File
domain.1 vname1 pass
domain.2 vname2 pass
domain.3 vname3 pass
domain.4 vname4 pass
domain.5 vname5 pass
domain.6 vname6 pass
domain.7 vname7 pass
domain.8 vname8 pass
domain.9 vname9 pass
domain.10 vname10 pass
domain.11 vname11 pass
domain.12 vname12 pass
domain.13 vname13 pass
domain.14 vname14 pass
domain.15 vname15 pass
domain.16 vname16 pass
domain.17 vname17 pass
domain.18 vname18 pass
domain.19 vname19 pass
domain.20 vname20 pass
domain.21 vname21 pass
domain.22 vname22 pass
domain.23 vname23 passAny help to fix this would be great I know its how I have them listed in the file that is the issue so my question is how do I fix it so wwwacct can read it properly?
-
Here is the output from the script, I forgot too add it. Output from script: root@server [~]# ./test1 +===================================+ | New Account Info | +===================================+ | Domain: domain.1 | UserName: domain.1 | PassWord: domain.1 +===================================+ This ok? yes Checking input data......Done Validating system setup......Done Rebuilding IP Pool......Done Validating IP......Done Validating Username...(XID 27yssf) "domain.1" is not a valid username on this system. +===================================+ | New Account Info | +===================================+ | Domain: vname1 | UserName: vname1 | PassWord: vname1 +===================================+ This ok? no Exiting on request!0 -
echo "domain.1" | sed -e 's/\.//' 0 -
Hello, Is it necessary to store actual usernames and passwords in a text file on the system in plaintext? You may want to consider developing a script that randomly generates the username/password for an account rather than using one from a list, as an added security precaution. Thank you. 0
Please sign in to leave a comment.
Comments
3 comments