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.
SCRIPT | PURPOSE |
---|---|
add_email.sh | script to add an email account to DirectAdmin via command line. |
addip | find the eth0:# and add the ip to DA and the system if specified |
awstats_process.sh | process Awstats for a domain - usage: ./awstats_process.sh USERNAME DOMAIN.COM |
backup_roundcube.php | Backup 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.php | accepts a string and returns to base64_encoded version of that string. |
change_database_username.php | script for moving a database to a different user |
change_username.sh | change the name of a user |
check_named_conf.sh | improves 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.sh | shows information about IPs connected to your server, the IP with most connections, and ss output if ss exists on the system |
cron_deny.sh | ensures 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 |
custom | directory containing custom scripts, see also: https://www.directadmin.com/features.php?id=2630 |
decrypt_file.sh | Read passphrase from file and decrypt using openssl aes-256-cbc and salt. Used for GDPR-compliant backup encryption/decryption. |
directadmin | directadmin daemon file |
directadmin_cron | directadmin cron file |
directadmin.rotate | logrotate config file for directadmin logs (/var/log/directadmin/* ) |
directadmin.service | DirectAdmin systemd service file |
dkim_create.sh | dkim 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.sh | Script for managing DNSSEC. |
doChecks.sh | This script will do the main checking to ensure that everything needed for DirectAdmin is ready to go. |
dovecot_compress.sh | used to gzip all emails in Maildir directory |
encrypt_file.sh | encrypts a password/passphrase with openssl enc -e -aes-256-cbc -salt, used for GDPR-compliant backups |
extra_load_info.sh | outputs 1) Top Memory Usage, 2) Virtual Memory Info, and 3) Current MySQL Queries |
fix_da_user.sh | script to regenerate the data files in /usr/local/directadmin/data/users/username |
fstab.sh | This script will ensure that the quotas are set in the fstab file |
ftp_download.php | used by the Remote ftp backup/restore (supports secure FTPS) |
ftp_download.php.curl | script used by the remote ftp backup/restore (using curl) |
ftp_list.php | script used by the remote ftp backup/restore |
ftp_upload.php | script used by the remote ftp backup/restore |
getDA.sh | script 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.sh | This 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.sh | A helper script to store license key to a license file. |
get_main_ip.sh | Script 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.sh | Script 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.sh | Used 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 feature. |
ip_info.sh | get the PTR record and WHOIS information for an IP (used to display IP information page under the Brute Force monitor) |
ipswap_reseller.sh | Script is used to change the IP of all Users owned by Reseller on a DA server (including the Reseller himself). |
ipswap.sh | script to change IPs on a DA server. |
is_systemd.sh | script to determine if the server runs systemd |
move_domain.sh | Script used to move domain from one user to another. |
move_user_to_reseller.sh | Script used to move user from one reseller to another. |
named | This shell script takes care of starting and stopping named. |
ncftp.sh | Install NcFTP version 3.2.6, which has been useful for system backups and for FTP backups (now uses curl or php). |
README | README file containing some information on the DirectAdmin installation. |
redirect.php | Copy of the redirect.php file used at /var/www/html/redirect.php |
removeip | remove the active ip from eth0 |
rename_database.sh | used to rename database from old name to new one |
rename_database_with_user.sh | used to move database and its user from one reseller to another |
reseller_to_user.sh | used to convert reseller to user (https://forum.directadmin.com/threads/new-scripts.19773/) |
reset_da_admin_password.sh | Use existing passwords to reset the da_admin account password. |
restore_roundcube.php | Restore 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.sh | Script to look up the rDNS via 'dig -x'. Used when domains are added to the BFM skip list. |
rotate_email_usage.sh | DirectAdmin resets the files in /etc/virtual/usage/* every day when the tally calls this script. For more information, see these links. |
selinux.sh | disable selinux... useful for running prior to installing DirectAdmin to ensure no firewall blocking occurs during the installation. |
service_memory_usage.sh | Script to see memory usage of running processes on your system. To be updated to use smem instead of ps. To sort from the largest usage to the least, try this command `sh service_memory_usage.sh |
set_permissions.sh | Script 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.sh | DirectAdmin 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.sh | used to move user from one reseller to another (creates a xml file from the squirrelmail address book and calls restore_roundcube.php.) |
startips | Script to load fresh IPs into the network device |
startips.service | startips systemd service file |
sysbk.sh | will in turn install sysbk, ncftp and add /root/.ssh/id_dsa if it doesn't exist |
tlsa.sh | used to recreate tlsa records for domain |
update.sh | DirectAdmin Update script |
user_to_reseller.sh | script used to convert user to reseller |