DA scripts explained

DirectAdmin panel provides a bunch of scripts for different purposes, all placed in the /usr/local/directadmin/scripts directory. The following serves as a quick reference for these scripts providing a description of each.

add_email.shopen in new windowscript to add an email account to DirectAdmin via command line.
addipfind the eth0:# and add the ip to DA and the system if specified
awstats_process.shopen in new windowprocess Awstats for a domain - usage: ./awstats_process.sh USERNAME DOMAIN.COM
backup_roundcube.phpBackup script for the per-domain RoundCube settings (generate a per-domain XML output of all users for that domain, in the roundcube database). See the restore_roundcube.php script also.
base64_encode.phpaccepts a string and returns to base64_encoded version of that string.
change_database_username.phpscript for moving a database to a different user
change_username.shchange the name of a user
check_named_conf.shimproves security of named and restricts zone transfers using the allow-transfer option, sets this to none if this doesn't already exist in the named.conf options
connection_info.shopen in new windowshows information about IPs connected to your server, the IP with most connections, and ss output if ss exists on the system
cron_deny.shensures that apache and webapps do not have access to run crontab command, script should be run at both the install time and for each DA update
customopen in new windowdirectory containing custom scripts, see also: https://www.directadmin.com/features.php?id=2630open in new window
decrypt_file.shRead passphrase from file and decrypt using openssl aes-256-cbc and salt. Used for GDPR-compliant backup encryption/decryption.
difficult_password.phpopen in new windowused to enforce a level of password difficulty that users must use (default is 6)
directadmindirectadmin daemon file
directadmin_crondirectadmin cron file
directadmin.rotatelogrotate config file for directadmin logs (/var/log/directadmin/*)
directadmin.serviceDirectAdmin systemd service file
dkim_create.shdkim script to create keys in /etc/virtual/domain.com, will ensure they exist and create them if missing, will also dump a task.queue entry to get DA to add the newly created key to the dns
dnssec.shScript for managing DNSSEC.
doChecks.shThis script will do the main checking to ensure that everything needed for DirectAdmin is ready to go.
dovecot_compress.shopen in new windowused to gzip all emails in Maildir directory
encrypt_file.shencrypts a password/passphrase with openssl enc -e -aes-256-cbc -salt, used for GDPR-compliant backups
extra_load_info.shopen in new windowoutputs 1) Top Memory Usage, 2) Virtual Memory Info, and 3) Current MySQL Queriesopen in new window
fix_da_user.shscript to regenerate the data files in /usr/local/directadmin/data/users/username
fstab.shThis script will ensure that the quotas are set in the fstab file
ftp_download.phpopen in new windowused by the Remote ftp backup/restore (supports secure FTPS)
ftp_download.php.curlscript used by the remote ftp backup/restore (using curl)
ftp_list.phpopen in new windowscript used by the remote ftp backup/restore
ftp_upload.phpopen in new windowscript used by the remote ftp backup/restore
getDA.shscript to download the DirectAdmin update script (useful for avoiding having to find your UID/LID for the wget command used to grab the update.tar.gz file from DirectAdmin as this script does this for you and then downloads the update.tar.gz file). This script replaces the wget command in the manual update instructions)
getInfo.shThis script will acquire all information needed to do the install (hostname, admin email, MySQL root password, creates the admin password and nameservers, etc.,) and will save it accordingly. It will use the information in the /usr/local/directadmin/conf/setup.txt or /usr/local/directadmin/scripts/setup.txt file if it exists, unless you choose to re-enter the information when running this script. You can stop the install at anytime and start over.
getLicense.shA helper script to store license key to a license file.
get_main_ip.shScript to return the main usable device IP address of the box, used for main outbound connections. On a LAN, this should match your directadmin.conf lan_ip setting. For normal servers, this will likely return your license IP (usually). Will also be the default IP that exim sends email through.
get_main_ip6.shScript to return the main usable device IPv6 address of the box. This currently makes a remote wget call, forced to use IPv6 with --inet6-only to obtain the IPv6 based on the returned value. This method may change, but appears to be reliable.
hostname.shUsed for changing the hostname. This script is called during hostname changes via Admin Level > Administrator Settings > Server's Hostname. Do note, though, that if you use this script via CLI to change your hostname, you must also manually rename the zone file as noted in this featureopen in new window.
ip_info.shopen in new windowget the PTR record and WHOIS information for an IP (used to display IP information page under the Brute Force monitor)
ipswap_reseller.shopen in new windowScript is used to change the IP of all Users owned by Reseller on a DA server (including the Reseller himself).
ipswap.shscript to change IPs on a DA server.
is_systemd.shscript to determine if the server runs systemd
move_domain.shScript used to move domain from one user to another.
move_user_to_reseller.shopen in new windowScript used to move user from one reseller to another.
namedThis shell script takes care of starting and stopping named.
ncftp.shInstall NcFTP version 3.2.6, which has been useful for system backupsopen in new window and for FTP backupsopen in new window (now uses curl or php).
READMEREADME file containing some information on the DirectAdmin installation.
redirect.phpCopy of the redirect.php file used at /var/www/html/redirect.php
removeipopen in new windowremove the active ip from eth0
rename_database.shused to rename database from old name to new one
rename_database_with_user.shused to move database and its user from one reseller to another
reseller_to_user.shused to convert reseller to user (https://forum.directadmin.com/threads/new-scripts.19773/)
reset_da_admin_password.shopen in new windowUse existing passwords to reset the da_admin account password.
restore_roundcube.phpopen in new windowRestore script for the per-domain RoundCube settings. This script will take an XML output (generated by backup_roundcube.php) and restore all elements for a given User, merging them into an active roundcube database. New IDs are generated, where applicable, so they will not be any conflicts if the IDs are different. Existing accounts will be respected, and only missing data is merged in. All variables are passed via environment, not command line options, but you can specify environmental variables... via command line options before the script (see the showHelp() function).
reverse_ip_lookup.shopen in new windowScript to look up the rDNS via 'dig -x'. Used when domains are added to the BFM skip list.
rotate_email_usage.shDirectAdmin resets the files in /etc/virtual/usage/* every day when the tally calls this script. For more information, seeopen in new window theseopen in new window linksopen in new window.
selinux.shdisable selinux... useful for running prior to installing DirectAdmin to ensure no firewall blocking occurs during the installation.
service_memory_usage.shopen in new windowScript to see memory usage of running processes on your system. To be updated to use smem instead of psopen in new window. To sort from the largest usage to the least, try this command `sh service_memory_usage.sh
set_permissions.shScript to set the file ownerships and permissions of all DA related files on the system. Should be quite useful for system restores, just make sure that the user accounts have already been created in the /etc/passwd, /etc/shadow, /etc/group files.
setup.shDirectAdmin setup.sh file is the first file to download when doing a DirectAdmin Install. It will ask you for relevant information and will download all required files.
squirrelmail_to_roundcube.shused to move user from one reseller to another (creates a xml file from the squirrelmail address book and calls restore_roundcube.php.)
startipsScript to load fresh IPs into the network device
startips.servicestartips systemd service file
sysbk.shopen in new windowwill in turn install sysbk, ncftp and add /root/.ssh/id_dsa if it doesn't exist
tlsa.shused to recreate tlsa records for domain
update.shDirectAdmin Update script
user_to_reseller.shscript used to convert user to reseller
Last Updated: