How to add files to DirectAdmin File Editor

DirectAdmin offers a simple File Editor utility that you can use to quickly edit important files. You can access it in DA >> System Info & Files >> File Editor. Notice that is accessible only to admin users. As you’ll see below, to edit certain files, you will need to enter the root password.

directadmin file editor
DirectAdmin File Editor

The DirectAdmin files that are listed in the File Editor are in the file:

/usr/local/directadmin/data/templates/edit_files.txt

Example content of the file:

/usr/local/directadmin/data/admin/ip_blacklist=user=root&group=root&permission=644
/usr/local/directadmin/data/admin/ip_whitelist=user=root&group=root&permission=644
/etc/ssh/sshd_config=user=root&group=root&permission=644&secure=yes
/etc/httpd/conf/httpd.conf=user=root&group=root&permission=644
/etc/httpd/conf/extra/httpd-includes.conf=user=root&group=root&permission=644&hide_if_not_exist=yes
/usr/local/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/php53/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/php54/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/php55/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/php56/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/php57/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/php70/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/php71/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/php72/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/php73/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/php74/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/usr/local/etc/php5/cgi/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes
/etc/exim.conf=user=root&group=root&permission=644
/etc/system_filter.exim=user=root&group=root&permission=644
/etc/dovecot/dovecot.conf=user=root&group=root&permission=644
/etc/aliases=user=root&group=root&permission=644
/etc/virtual/domainips=user=mail&group=mail&permission=640
/etc/virtual/helo_data=user=mail&group=mail&permission=640
/etc/virtual/snidomains=user=mail&group=mail&permission=640
/etc/proftpd.conf=user=root&group=root&permission=644&secure=yes
/etc/pure-ftpd.conf=user=root&group=root&permission=644&secure=yes
/etc/hosts.allow=user=root&group=root&permission=644
/etc/hosts.deny=user=root&group=root&permission=644
/etc/proftpd.vhosts.conf=user=root&group=root&permission=644
/usr/local/directadmin/conf/directadmin.conf=user=diradmin&group=diradmin&permission=600&secure=yes
/usr/local/directadmin/data/templates/edit_files.txt=user=root&group=root&permission=644&secure=yes
/usr/local/directadmin/data/templates/per_email_limit_email_message.txt=user=root&group=root&permission=644&secure=yes
/usr/local/directadmin/data/templates/custom/per_email_limit_email_message.txt=user=root&group=root&permission=644&secure=yes&hide_if_not_exist=yes
/etc/exim.key=user=mail&group=mail&permission=644
/etc/exim.cert=user=mail&group=mail&permission=644
/var/spool/exim/blocked_authenticated_users=user=mail&group=mail&permission=600&hide_if_not_exist=yes
/var/spool/exim/blocked_script_paths=user=mail&group=mail&permission=600&hide_if_not_exist=yes
/etc/httpd/conf/ssl.crt/server.crt=user=root&group=root&permission=600
/etc/httpd/conf/ssl.key/server.key=user=root&group=root&permission=600
/etc/httpd/conf/ssl.crt/server.crt=user=root&group=root&permission=600
/usr/local/directadmin/conf/cacert.pem=user=diradmin&group=diradmin&permission=400
/usr/local/directadmin/conf/cakey.pem=user=diradmin&group=diradmin&permission=400
/usr/local/directadmin/conf/carootcert.pem=user=diradmin&group=diradmin&permission=400
/etc/named.conf=user=root&group=root&permission=644&hide_if_not_exist=yes
/etc/bind/named.conf=user=root&group=root&permission=644&hide_if_not_exist=yes
/etc/namedb/named.conf=user=root&group=root&permission=644&hide_if_not_exist=yes

The entries with “&secure=yes” means that you will be asked for the root password when editing the file from the DA GUI.

To add/remove file entries, copy the edit_files.txt to the /usr/local/directadmin/data/templates/custom/ directory:

cd /usr/local/directadmin/data/templates
cp edit_files.txt custom/

Now you can edit the /usr/local/directadmin/data/templates/custom/edit_files.txt file with your preferred text editor.

You can also add entries to the file from the command line. For example to add the PHP 8.0 ini file, use:

echo "/usr/local/php80/lib/php.ini=user=root&group=root&permission=644&hide_if_not_exist=yes&secure=yes" >> /usr/local/directadmin/data/templates/custom/edit_files.txt

Access the DA GUI File Editor again and you will see the newly added configuration file.

Important: Double-check the correct user, the group, and the permission of the file.

Links:
DA File Editor feature

Leave a Reply