DirectAdmin and CustomBuild commands cheat sheet

This cheat sheet brings together the most useful commands for managing a DirectAdmin server from the command line: updates, login and settings, services, CustomBuild, the web server, PHP, users and the task queue, backup and restore, DNS, email, SSL certificates, databases, and log locations. You can search for a command, filter by topic, and copy it with one click.

Version, updates, and license

  • da version

    Shows the installed DirectAdmin version.

  • da update

    Updates DirectAdmin to the latest version in the update channel set on the server.

  • da config-get update_channel

    Shows the server's update channel. The channels are stable, current, and alpha.

  • da config-set update_channel stable

    Changes the update channel, to stable in this example. The next DirectAdmin update comes from the new channel.

  • da license

    Shows the details of the DirectAdmin license on the server.

Login and settings

  • da login-url

    Creates a one-time login link to the control panel as the server administrator, without a password. Useful when the administrator password isn't available.

  • da login-url --user=fred --expiry=1d

    Creates a login link for the user fred that's valid for one day. The time units are s, m, h, d, w, M, and y, and they're case-sensitive.

  • passwd admin

    Changes the password of the admin user, which is also used to log in to the control panel. Change another user's password the same way.

  • da config-get ns1

    Shows the value of a single setting, in this example the primary name server set on the server.

  • da config-set letsencrypt 1

    Changes the value of a setting, in this example enabling Let's Encrypt. You can also write letsencrypt=1. After the change, the DirectAdmin service reloads automatically, and with --no-reload it doesn't reload.

  • curl -k "$(da api-url)/CMD_API_SHOW_ALL_USERS?json=yes"

    Calls the DirectAdmin API from the server itself, in this example to list all users. The da api-url command creates a URL with an access key for the administrator, and with --user=fred for another user.

Services

  • systemctl status directadmin

    Shows whether the DirectAdmin service is running.

  • systemctl restart directadmin

    Restarts the DirectAdmin service. Websites and email keep running during the restart.

  • systemctl restart php-fpm83

    Restarts PHP-FPM for a specific version. The service name includes the version number without a dot, for example php-fpm82.

  • systemctl restart exim

    Restarts Exim, the incoming and outgoing mail server. Restart dovecot the same way.

  • /usr/local/lsws/bin/lswsctrl restart

    Restarts OpenLiteSpeed, for example to apply changes to .htaccess files.

CustomBuild: settings and updates

  • da build versions

    Lists the software components with pending updates, and for each component the command that updates only that component. On older DirectAdmin versions, the command lists every installed component.

  • da build update_versions

    Updates every software component that has a new version. The run can take a long time, so it's best to run it during a quiet period.

  • da build options

    Shows the CustomBuild settings: the current value, the default value, and the possible values. The da build opt_help command shows the same output.

  • grep webserver= /usr/local/directadmin/custombuild/options.conf

    Shows a single setting from options.conf, the file that stores all CustomBuild settings in key=value format.

  • da build set updates yes

    Enables automatic updates of the software components. The autoupdate_time and autoupdate_day settings set the time and day of the update.

  • da build rewrite_confs

    Regenerates the web server configuration files from the templates. Run it after you change settings or templates.

  • cd /usr/local/directadmin/custombuild && ./build options

    The older form of CustomBuild commands. It still works, but the current documentation uses da build.

Switching the web server

  • da build opt_help | grep webserver

    Shows the current web server and the supported options: apache, nginx, nginx_apache, litespeed, and openlitespeed.

  • da build set webserver nginx_apache

    Selects the web server. With nginx_apache, nginx serves static files, and Apache handles dynamic requests and .htaccess files.

  • da build set php1_mode php-fpm

    Selects how PHP runs. With Apache and nginx, use php-fpm, and with LiteSpeed and OpenLiteSpeed, use lsphp.

  • da build nginx_apache

    Installs the selected web server. Then run da build php and da build rewrite_confs to complete the switch.

PHP versions

  • da build set php1_release 8.3

    Sets the main PHP version on the server. After the change, run da build php and da build rewrite_confs.

  • da build set php2_release 8.2

    Adds another PHP version that users can choose for each domain in the control panel. The value no removes the additional version.

  • da build php

    Installs the configured PHP versions. The installation compiles PHP and takes a few minutes.

  • da build set php_redis yes && da build php_redis

    Enables and installs a PHP extension, Redis in this example. Install extensions such as imagick, imap, and ioncube the same way.

  • /usr/local/php83/lib/php.ini

    The php.ini file of version 8.3. For each version, the path is /usr/local/phpXX/lib/php.ini, and additional configuration files are read from the php.conf.d directory next to it.

Users, domains, and the task queue

  • da suspend-user --user=fred --reason=billing

    Suspends a user and their websites. The reason is optional, and the possible values include billing, abuse, spam, inactive, and other. The da unsuspend-user --user=fred command lifts the suspension.

  • da suspend-domain --domain=example.com

    Suspends a single domain. The da unsuspend-domain --domain=example.com command reactivates it.

  • da docs-root

    Shows the website directories of every domain and subdomain on the server, in JSON format.

  • cd /usr/local/directadmin/scripts && ./change_username.sh fred fred2

    Renames the user fred to fred2. Back up the user's databases before you run it.

  • cd /usr/local/directadmin/scripts && ./move_domain.sh example.com fred john

    Moves a domain from the user fred to the user john. The databases don't move with the domain, so move them separately.

  • da taskq --run 'action=rewrite&value=httpd'

    Runs a task from the task queue immediately, in this example regenerating the web server configuration for all users. You can limit the task to a single user with &user=fred.

  • echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue

    Adds a task to the queue. The queue is processed automatically every minute, so the task runs within about a minute.

Backup and restore

  • da admin-backup --destination=/home/admin/admin_backups

    Creates a backup of every user on the server in the specified directory.

  • da admin-backup --destination=/home/admin/admin_backups --user=fred --user=john

    Backs up only the specified users. Add a separate --user for each user.

  • echo "action=restore&value=multiple&local_path=/home/admin/admin_backups&owner=admin&when=now&where=local&type=admin&ip_choice=file&select0=user.admin.fred.tar.gz" >> /usr/local/directadmin/data/task.queue

    Caution: restores the user from the backup file, and the user's existing data on the server may be overwritten. ip_choice=file uses the IP address from the backup, and for more files, add select1, select2, and so on.

  • da build set mysql_backup yes && da build mysql_backup

    Creates an SQL backup of every database in the CustomBuild mysql_backups directory. It's best to run it before you upgrade MariaDB or MySQL.

DNS

  • da taskq --run 'action=dns&do=add&domain=example.com&type=A&name=mail&value=192.0.2.10&ttl=3600'

    Adds an A record for mail.example.com. Add records of other types, such as CNAME or TXT, the same way.

  • da taskq --run 'action=dns&do=delete&domain=example.com&type=A&name=mail&value=192.0.2.10'

    Deletes a DNS record. The value * instead of a specific value deletes every record of the same type and name.

Email and the Exim queue

  • exim -bpc

    Shows the number of messages waiting in the mail queue.

  • exim -bp | exiqsumm

    Shows a summary of the queue by destination domain: the number of messages, their size, and how long they've been waiting.

  • exim -Mvh MESSAGE_ID

    Shows the headers of a queued message. The -Mvb option shows the message body, and -Mvl shows its delivery log.

  • exim -qff

    Retries delivery of every message in the queue, including frozen messages.

  • exim -Mrm MESSAGE_ID

    Caution: deletes a message from the queue without sending it and without notifying the sender.

  • exiqgrep -z -i | xargs exim -Mrm

    Caution: deletes all frozen messages from the queue. Before you delete them, run exiqgrep -z -c to see how many messages will be deleted.

  • da doveadm-quota --email=info@example.com

    Shows a mailbox's usage and quota, in KB. The output 0:0 means a mailbox with no limit.

  • doveadm quota recalc -u info@example.com

    Recalculates a mailbox's quota usage when the size shown doesn't match the mailbox contents.

SSL certificates

  • /usr/local/directadmin/scripts/letsencrypt.sh server_cert

    Issues or renews the Let's Encrypt certificate for the server's hostname, which the control panel and the mail services use.

  • da build letsencrypt

    Updates the DirectAdmin Let's Encrypt script and the ACME client it uses.

  • da taskq --run 'action=rewrite&value=letsencrypt&domain=example.com' --debug 3100

    Runs the Let's Encrypt renewal check for a domain's certificate and shows the details. The certificate is renewed only when it's close to its renewal date.

Databases

  • cat /usr/local/directadmin/conf/mysql.conf

    Shows the login details DirectAdmin uses to manage the databases. The file is sensitive, so don't copy it or share its contents.

  • da build set mariadb 11.4 && da build mariadb

    Caution: upgrades MariaDB to the selected version. Back up every database before the upgrade, and upgrade one version at a time.

Security and permissions

  • /usr/local/directadmin/data/admin/ip_blacklist

    The list of IP addresses blocked from logging in to the control panel after repeated failed login attempts (Brute Force Monitor). Removing an address from the file unblocks it.

  • da permissions

    Fixes the permissions of DirectAdmin's own files when the control panel fails because of incorrect permissions.

Log locations

  • /var/log/directadmin/

    The DirectAdmin logs: error.log for service errors, system.log for actions such as creating and deleting users, errortaskq.log for task queue errors, and login.log for failed login attempts.

  • /var/log/httpd/domains/example.com.error.log

    The Apache error log of a website, including PHP errors. The access log is in the same directory, named example.com.log, and with nginx, the logs are in /var/log/nginx/domains/.

  • /var/log/exim/mainlog

    The main Exim log, with every message sent and received. For mailbox login problems, check /var/log/maillog.

  • /usr/local/directadmin/data/users/fred/domains/acme_provider_cert_logs/example.com.log

    The log of Let's Encrypt requests for a domain. Check it first when issuing or renewing a certificate fails.

Before you work with DirectAdmin from the command line

  • The da command: da is short for /usr/local/directadmin/directadmin, and you run it as root. The da --help command lists all subcommands, and older guides use the full path instead of da.
  • da build and ./build: CustomBuild is installed in /usr/local/directadmin/custombuild. The current documentation uses da build, and older guides show the same command as ./build from that directory. The commands are identical, and both forms work.
  • The task queue: A task written to the task.queue file runs within about a minute, when the queue is processed. The da taskq --run command runs the task immediately and shows the result.
  • Switching the web server or PHP: Change the settings with da build set, install the component, and then run da build php and da build rewrite_confs. Back up the server before the change, and make it during a quiet period.

The usernames, domains, IP addresses, and version numbers on this page are examples, so replace them with your real values. For an explanation of the records you add to a DNS zone, see DNS record types, and for commands that work with the database itself, see MySQL commands.

Did you know?

On a Linux VPS, you can choose DirectAdmin as the control panel, licensed by the number of domains and installed by our team. You connect over SSH with full root access and run every command on this page directly on the server.

Linux VPS plans

DirectAdmin and CustomBuild commands FAQ

How do I log in to DirectAdmin when the administrator password isn't available?

Connect to the server over SSH as root and run da login-url. The command creates a one-time login link to the control panel as the server administrator. After you log in, you can set a new password, or change it from the command line with passwd admin. With --user=fred, the command creates a link for another user.

How do I update DirectAdmin and the software on the server?

The da update command updates DirectAdmin itself to the latest version in the server's update channel. The software the control panel manages, such as the web server, PHP, the mail server, and the database, is updated through CustomBuild: da build versions shows which components need an update, and da build update_versions updates all of them. The da version command shows the installed version.

What's the difference between da build and ./build?

There's no difference in the result. ./build is the CustomBuild script in /usr/local/directadmin/custombuild, and da build runs it from anywhere on the server. The current DirectAdmin documentation uses da build, so it's best to work that way. When an older guide shows a command like ./build php, run the same command as da build php.

How do I add or change a PHP version on a DirectAdmin server?

Set the main version with da build set php1_release, and additional versions with php2_release, php3_release, and so on. After the change, run da build php to install the versions, and da build rewrite_confs to update the web server configuration. When several versions are installed, users choose the version for each domain in the control panel.

Where are the DirectAdmin and website logs?

The DirectAdmin logs are in /var/log/directadmin/, including error.log, system.log, and login.log. The logs of each website are in /var/log/httpd/domains/ on a server with Apache, or in /var/log/nginx/domains/ on a server with nginx, with one file for errors and one for access. The log of incoming and outgoing mail is /var/log/exim/mainlog.

Shopping cart

Your cart is emptyYou can start with one of our popular plans.

Site search

Accessibility

Text size
100%
Accessibility statement