By the way, using your script I have made a script to recreate directories and correct ownerships + directory / file modes. Someone might find this usefull.
Quote:#!/bin/bash
#
# PROCESS DIRECTORY RIGHTS (OWNERSHIP & CHMOD)
#
# !!!! Edit path to mysql cnf file !!!!
mycnf=/home/manager/mysql.cnf
# sample mysql.cnf looks like this:
# [client]
# user=user_for_ispcp_database_usualy_root
# password=password_of_user
for domain_id in `echo "SELECT domain_id FROM ispcp.domain" | mysql --defaults-file=$mycnf -s`;
do
uid=`echo "SELECT domain_uid FROM ispcp.domain WHERE domain_id='$domain_id'" | mysql --defaults-file=$mycnf -s`;
gid=`echo "SELECT domain_gid FROM ispcp.domain WHERE domain_id='$domain_id'" | mysql --defaults-file=$mycnf -s`;
dmn=`echo "SELECT domain_name FROM ispcp.domain WHERE domain_id='$domain_id'" | mysql --defaults-file=$mycnf -s`;
echo "===========================================================";
echo " $dmn";
echo "===========================================================";
# process ftp
mkdir /var/www/virtual/$dmn
chown -vR vu$uid:vu$gid /var/www/virtual/$dmn
chmod 770 /var/www/virtual/$dmn
chown -v vu$uid:www-data /var/www/virtual/$dmn
mkdir /var/www/virtual/$dmn/backups
chown -vR vu$uid:www-data /var/www/virtual/$dmn/backups
chmod 770 /var/www/virtual/$dmn/backups
mkdir /var/www/virtual/$dmn/cgi-bin
chown -vR vu$uid:vu$gid /var/www/virtual/$dmn/cgi-bin
chmod 755 /var/www/virtual/$dmn/phptmp
mkdir /var/www/virtual/$dmn/errors
chown -vR vu$uid:vu$gid /var/www/virtual/$dmn/errors
chmod 775 /var/www/virtual/$dmn/errors
mkdir /var/www/virtual/$dmn/htdocs
chown -vR vu$uid:vu$gid /var/www/virtual/$dmn/htdocs
chmod -R -s /var/www/virtual/$dmn/htdocs
chmod -R 664 /var/www/virtual/$dmn/htdocs
find /var/www/virtual/$dmn/htdocs -type d -exec chmod 775 {} \;
chown -v vu$uid:www-data /var/www/virtual/$dmn/.ht*
chmod 640 /var/www/virtual/$dmn/.ht*
mkdir /var/www/virtual/$dmn/logs
chown -vR vu$uid:www-data /var/www/virtual/$dmn/logs
chmod 770 /var/www/virtual/$dmn/logs
mkdir /var/www/virtual/$dmn/phptmp
chown -vR vu$uid:www-data /var/www/virtual/$dmn/phptmp
chmod 770 /var/www/virtual/$dmn/phptmp
mkdir /var/www/fcgi/$dmn
chown -vR vu$uid:vu$gid /var/www/fcgi/$dmn
chmod 755 /var/www/fcgi/$dmn
done
Edit: corrected ownership for /var/www/fcgi/* dirs
Edit2: fine tuned chmod under htdocs (775 for dirs and 664 for files)