Achterstraat
Verified User
Many people ask for it, here it is!
Example:
__R: admin
____U: user1
______D: domain1.tld
________S: sub.domain1.tld
________P: otherdomain1.tld
________E: [email protected]
__R: admin
____U: user2
______D: domain2.tld
________S: sub.domain2.tld
________P: otherdomain2.tld
________E: [email protected]
Source: Github
Bash:
#!/bin/sh
tabs=""
if [ ! -z "${1}" ]; then user="${1}"; else user=""; fi
users=/usr/local/directadmin/data/users
virtual=/etc/virtual
for u in `ls ${users}/*/users.list`;
do
r=`echo ${u} | cut -d/ -f7`
if [ -z "${user}" ]; then echo -e "R: ${r}"; fi
for u in `cat ${u}; echo ${r}`;
do
if [ -z "${user}" ]; then echo -e "\tU: ${u}"; else u="${user}"; fi
for d in `cat ${users}/${u}/domains.list`;
do
if [ -z "${user}" ]; then tabs="\t\t"; else tabs=""; fi
echo -e "${tabs}D: ${d}"
tabs+="\t"
if [ -f "${users}/${u}/domains/${d}.subdomains" ]; then
for s in `cat ${users}/${u}/domains/${d}.subdomains | sort`;
do
echo -e "${tabs}S: ${s}.${d}"
done
fi
if [ -f "${users}/${u}/domains/${d}.pointers" ]; then
for p in `cat ${users}/${u}/domains/${d}.pointers | sort | cut -d'=' -f1`;
do
echo -e "${tabs}P: ${p}"
done
fi
if [ -f "${virtual}/${d}/passwd" ]; then
for e in `cat ${virtual}/${d}/passwd | sort | cut -d':' -f1`;
do
echo -e "${tabs}E: ${e}@${d}"
done
fi
done
if [ -z "${user}" ]; then continue; else exit; fi
done
done
Example:
__R: admin
____U: user1
______D: domain1.tld
________S: sub.domain1.tld
________P: otherdomain1.tld
________E: [email protected]
__R: admin
____U: user2
______D: domain2.tld
________S: sub.domain2.tld
________P: otherdomain2.tld
________E: [email protected]
Source: Github
Last edited: