DirectAdmin Knowledge Base and Support

DirectAdmin is a web panel for a simple administration of both virtual and dedicated servers. DirectAdmin is faster, safe and more powerful than any other CP. And we know how to customize and support it.

How to create a CSV file of all users with domains on DirectAdmin

| 12:56:23 18.07.2019

In order to create a CSV file of all users with domains hosted on a DirectAdmin server in a format "User;Contact Email;domain(s);Package;Reseller;" follow the instructions below.

List of all users

A list of all users can be build from /usr/local/directadmin/data/users/*/users.list. The file exists under resellers in DirectAdmin, and lists all their users. So for the default admin account (it has admin/reseller/user levels) it will be 

  • /usr/local/directadmin/data/users/admin/users.list

So if we unify content of files from all resellers we will get a list of all users from a single server.

Users metadata

All the information about DirectAdmin users can be found in /usr/local/directadmin/data/users/*/user.conf, and again the default admin account will have 

  • /usr/local/directadmin/data/users/admin/user.conf

which contains all possible metadata.

Users domains

A list of all user's domains can be found in /usr/local/directadmin/data/users/*/domains.list. The user admin will have

  • /usr/local/directadmin/data/users/admin/domains.list

listing all domains hosted under the account.

Creating CSV report

So now we need to go through a loop, collect the desired data and build a report. Here is an example of a shell command which we can use in a server console as root:

for USER in $(cat /usr/local/directadmin/data/users/*/users.list | sort | uniq); do \
echo "${USER};$(grep ^email= /usr/local/directadmin/data/users/${USER}/user.conf | cut -d= -f2);\
$(cat /usr/local/directadmin/data/users/${USER}/domains.list | xargs);\
$(grep ^package= /usr/local/directadmin/data/users/${USER}/user.conf | cut -d= -f2);\
$(grep ^creator= /usr/local/directadmin/data/users/${USER}/user.conf | cut -d= -f2);"; \

Here is an example of the output:


Domains will be space-separated.

That's it.

About Us
We are a team of professionals, and specialize in installation, configuring and managing of remote virtual and dedicated servers powered by Linux/Unix-like OS with DirectAdmin. We support various sets of software, including web-servers Apache, Nginx; internet domain name servers Bind, PowerDNS; mail-servers with POP3, IMAP and SMTP, FTP-servers, etc. After years of working through the most complex server challenges our team has gathered valuable experience and universal solutions suitable for everyday tasks. We are here to lend you a helping hand and take care of your servers in order to let you have enough time to do more of what you love.

All of the information and data on this site is for informational purposes only and is provided for the convenience of the user.
Powered by: Amiro.CMS - Free edition