Commit fa40f564 authored by Vitaly Lipatov's avatar Vitaly Lipatov

merge dir perms and owners code, add refresh_dirs.sh script

parent 9accf4bd
...@@ -29,18 +29,14 @@ cd /etc/httpd2/conf/sites-enabled || exit ...@@ -29,18 +29,14 @@ cd /etc/httpd2/conf/sites-enabled || exit
umask u=rwx,g=rwx,o=x umask u=rwx,g=rwx,o=x
if [ ! -d "$LOGDIR" ] ; then if [ ! -d "$LOGDIR" ] ; then
mkdir -p $LOGDIR $HOSTBASE $SESSIONDIR # create all dir from scratch
chown -R $2:webmaster /home/$2 set_dirperms
chmod g+rwx /home/$2
chmod g+s /home/$2
chmod g-w /home/$2
chmod o-rwx /home/$2 /home/$2/www
chown -R root:root $LOGDIR
chmod 0755 $LOGDIR
fi fi
#mkdir -p $SITE/cgi #mkdir -p $SITE/cgi
mkdir -p $SITEDIR mkdir -p $SITEDIR $SESSIONDIR
chown $USERNAME $SESSIONDIR/
#mkdir -p $LOGDIR #mkdir -p $LOGDIR
#test -f $SITE/favicon.ico || cp -f ./favicon.ico $SITE/favicon.ico #test -f $SITE/favicon.ico || cp -f ./favicon.ico $SITE/favicon.ico
test -f $SITEDIR/favicon.ico || touch $SITEDIR/favicon.ico test -f $SITEDIR/favicon.ico || touch $SITEDIR/favicon.ico
...@@ -58,6 +54,7 @@ create_site_config ...@@ -58,6 +54,7 @@ create_site_config
service httpd2 reload service httpd2 reload
service httpd2 status && echo OK # starthttpd2 forces run httpd2
service httpd2 status || starthttpd2
echo "You can use technical name: $TECHNAME.$TECHHOST for access to the site." echo "You can use technical name: $TECHNAME.$TECHHOST for access to the site."
...@@ -13,6 +13,33 @@ set_vars() ...@@ -13,6 +13,33 @@ set_vars()
SITEDIR=$HOSTBASE/$DOMAINNAME SITEDIR=$HOSTBASE/$DOMAINNAME
} }
set_dirperms()
{
# TODO: merge with add_site
# home
mkdir -p $HOMEDIR
chown -v $USERNAME:webmaster $HOMEDIR
chmod -v 0750 $HOMEDIR
chmod -v g-s $HOMEDIR
# www
mkdir -p $HOSTBASE
chown root:webmaster $HOSTBASE
chmod -v 0775 $HOSTBASE
chmod -v g-s $HOSTBASE
# www/sites
chown $USERNAME:webmaster $HOSTBASE/*
chmod -v 0770 $HOSTBASE/*
chmod -v g+s $HOSTBASE/*
# log
mkdir -p $LOGDIR
chown -R -v root:apache2 $LOGDIR
chmod -v 0755 $LOGDIR
}
check_dir() check_dir()
{ {
local dir=$1 local dir=$1
......
#!/bin/sh
. ./config
. ./functions
. ./functions-apache
cd /home || exit
LISTUSER="*"
[ -n "$*" ] && LISTUSER="$*"
for USERNAME in $LISTUSER ; do
echo $USERNAME
set_vars
set_dirperms
done
...@@ -24,8 +24,9 @@ for i in $LISTCONF ; do ...@@ -24,8 +24,9 @@ for i in $LISTCONF ; do
ALIASLIST=$(get_aliaslist $i) ALIASLIST=$(get_aliaslist $i)
[ -z "$ALIASLIST" ] || echo " Alias list: $ALIASLIST" [ -z "$ALIASLIST" ] || echo " Alias list: $ALIASLIST"
mkdir -p $SESSIONDIR/ # one time fix
chown $USERNAME $SESSIONDIR/ #mkdir -p $SESSIONDIR/
#chown $USERNAME $SESSIONDIR/
check_dirs check_dirs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment