Disaster recovery

Question:

My Centova Cast v2 installation was damaged and I tried to repair it. I've re- uploaded all of the files; can I just set the permissions to 0777 to make everything work?

Answer:

No. Setting permissions to 0777 is guaranteed to cause problems -- both technical and security-related. Note that Centova Cast is not a typical PHP script; it is a control panel, and due to its nature of operation it has special requirements in terms of ownerships and permissions. More information is included in the sections below.

Procedures described hereunder are dangerous and unsupported

Please note that we cannot provide support for anything explained below; this article is intended to assist advanced users in recovering a damaged installation, but this is outside of the scope of the Centova Cast support agreement. Please also note that the procedures described below are advanced and risky, and may result in data loss if performed incorrectly.

Recovery by a Centova Technologies Technician

If you have any doubts about your ability to perform a recovery, but are sure your data is intact, you may wish to contact Centova Technologies to have an experienced technician perform the recovery for you. In most cases, this requires less than an hour of time and thus will only incur a fee of one hour of professional services (priced at USD$69.99 at the time of this writing).

Manual recovery

If you are sure you have re-uploaded all of the files correctly, and/or your original files are still intact and have not been damaged or deleted, and are all located in the same paths as you originally installed them:

  1. If you are using Centova Cast v2.2.0 or better, you can run the /home/centovacast/scripts/fixperms.sh script to automatically correct your filesystem permissions and ownerships. If you use this script, you can skip steps 2-4.

    NOTE: This script makes a best-effort attempt to fix the permissions problems, but in some cases it may fail. If you receive any errors, you will need to proceed with the manual process in steps 2-4 below.

  2. Ensure that the permissions on /home/centovacast and your Centova Cast web interface directory (and their contents) are NOT 0777. Set them as follows to ensure that they are correct:

    chmod -R 0755 /home/centovacast
    chmod 0711 /home/centovacast/vhosts/*
    chmod 0700 /home/centovacast/vhosts/*/etc
    chmod 0711 /home/centovacast/vhosts/*/var/log
    chmod 0700 /home/centovacast/vhosts/*/var/run
    chmod 0600 /home/centovacast/vhosts/*/etc/*
    chmod 0600 /home/centovacast/vhosts/*/var/log/*
    chmod 0755 /home/centovacast/vhosts/*/var/log/reports
    chmod 0644 /home/centovacast/vhosts/*/var/log/reports/*
    chmod 0600 /home/centovacast/vhosts/*/var/run/*
    chmod -R 0755 /path-to-centovacast-web-interface/
    
  3. Recursively change the owner and group of /home/centovacast to the user account under which Centova Cast was installed. Usually, the user account is named centovacast, i.e.:

    chown -R centovacast.centovacast /home/centovacast/

  4. Change to the `/home/centovacast/system/runascc directory and run these two commands:

    rm -f runascc spawn castd
    make all
    

    This should yield a working Centova Cast installation.

Changing the Centova Cast user account

While we strongly recommand against doing so, if you change the UID/GID of the user account under which Centova Cast runs as part of the above process, you will need to edit the Centova Cast database and change the ccuid/ccgid fields in the settings table to match the new UID/GID.

Changing the Centova Cast core files path

While we strongly recommand against doing so, if you change the location of Centova Cast's files, you will need to edit config.php in your Centova Cast web interface directory, as well as in /home/centovacast, and update them with the new path. You will also need to edit your Centova Cast database and change the vhostpath field in the settings table.

Reinstallation and recovery

If your Centova Cast installation is damaged beyond repair, the best approach is often to reinstall Centova Cast, then restore your old data. Please note that this is a particularly risky procedure; be sure to backup your data carefully in advance.

To perform a reinstallation and subsequent recovery:

  1. Backup your Centova Cast database and the /home/centovacast/vhosts/ directory, maintaining permissions and ownership on the latter (i.e., using tar or rsync for the backup). If either of these items are lost, then your installation has sustained permanent data loss and recovery will not be possible.

    Note that this is not simply a cautionary procedure; you will need to restore this backup at the end of the recovery process, so do not skip this step.

  2. Delete the /home/centovacast/system directory, the /home/centovacast/vhosts directory, and your Centova Cast web interface directory.

  3. Download a fresh copy of Centova Cast from the Centova Technologies web site. Ensure that you download the exact same version as you already have installed.

  4. Unpack the Centova Cast tarball to a temporary directory.

  5. Edit the install.sh file and set the CREATEUSER setting to 0. This will allow Centova Cast to re-use your existing Centova Cast UID/GID.

  6. Install Centova Cast as usual, as descrbied in the installation manual. Ensure that you install it exactly as you did the first time (using the same paths and so-on) otherwise your database will become desynchronized from the configuration files.

  7. Remove all tables from the newly-installed Centova Cast database, and restore the backup you made of your Centova Cast database.

  8. Restore your backup of the /home/centovacast/vhosts/ directory, maintaining ownerships and permissions.

At this point, you should have a working Centova Cast installation.

NOTE: This article is for Centova Cast v2 only; an alternate version exists for Centova Cast v3.