DirectAdmin

DirectAdmin user and password

I've had to test some connectivity issues with pop and imap clients without having access to their account info.

"/etc/virtual/{domain.tld}/passwd" file holds their user and md5 password hash. Make sure to backup this file first.

Generate a new md5-based password hash:

openssl passwd -1

Edit "/etc/virtual/{domain.tld}/passwd" file replacing the password hash with the above.

Test login to mail.

Once debugging is finished, restore the file back.

suphp-0.7.1 and DirectAdmin

Recently upgraded server running DirectAdmin to suphp-0.7.1 via the Custombuild. However, got "500 Internal Server Error" on accessing sites running on php5-cgi with log as below:

SecurityException in Application.cpp:511: Unknown Interpreter: php

The solution was to update the suphp.conf file as below:

Edit "/usr/local/suphp/etc/suphp.conf" and change from:

[handlers]
;Handler for php-scripts
x-httpd-php5=php:/usr/local/php5/bin/php-cgi

;Handler for CGI-scripts
x-suphp-cgi=execute:!self

to:

[handlers]
;Handler for php-scripts
x-httpd-php5="php:/usr/local/php5/bin/php-cgi"

;Handler for CGI-scripts
x-suphp-cgi="execute:!self"

Note the double quotes for the variables.

Running `./build rewrite_confs` should fix this issue as well.

Upgrading php on DirectAdmin Servers

Download the source tar.gz file from php.net and place it in "/usr/local/directadmin/customapache"

Edit the "/usr/local/directadmin/customapache/build" file and change the version of php to the version that was downloaded.

Then run:

# cd /usr/local/directadmin/customapache/
# ./build clean
# ./build update
# ./build all

Restart apache when finished.

Migrating sites between DirectAdmin servers

These are some basic notes for reference just in case I need to do the migration thing again!!!

Steps taken on the old server

  1. Created a new reseller account.

  2. Created sites in the new reseller account as domain.com2 for the domains that needed to be migrated. DA won't let you add the same name twice, which is why I used a different one for the time being. Doing this will setup all the required files/paths needed to use the website.

  3. Copied the files to the new domain.
    # cp -pR /home/olduser/domains/domain.com/* /home/newuser/domains/domain.com2/
    # chown -R newuser:newuser /home/newuser/domains/domain.com2
  4. Did a search for the old file path and updated it to the new file path.
    # for x in `find /home/newuser/domains/*/public_html -type f -print0 | xargs --null grep -l /home/olduser`; do perl -pi.bak -e 's/\/home\/olduser/\/home\/newuser/g' $x ; done
  5. Swapped around the the email folders.
    # cd /etc/virtual
    # mv domain.com domain.com.tmp
    # mv domain.com2 domain.com
    # mv domain.com.tmp domain.com2
  6. Copied over the imap files. Any data in /home/olduser/imap needed to be copied over. There will also be permission issues as well, but can be fixed afterwards with the set_permissions.sh script.

  7. Changed user for the imap files.
    # find /home/newuser/imap -user olduser | xargs chown newuser:newuser
  8. Renamed the existing domains with a suffix of ".old".

  9. Renamed the new domains to domain.com from domain.com2.

  10. Logged in as reseller and created a backup.

  11. Created a script and dumped out single databases.
    #!/bin/bash
    # dbExport.sh

    OLD_DB=(
    db1
    db2
    db3
    ...
    )

    for ((i=0; i<${#OLD_DB[@]}; i++))
    do
      mysqldump --opt -u root --password={psswd} ${OLD_DB[$i]} > ./db/${OLD_DB[$i]}.db
    done
  12. Did a search and created a list of folders with 777 permission set.
    # find /home/newuser/domains -perm 0777 -type d > 777.txt
  13. Setup dns for each domain with a www1 A record to point to the new server IP. Better solution, would be to edit the local hosts file for testing purpose.

Syndicate content
Comment