Что приходится делать сейчас чтобы верифицировать файлы в «1» и «2» каталогах у пользователей с доверенного пользователя (это просто раздражает, а что поделать)
Добавить в файл в Крон:
/bin/sh /var/srvscr/phpfix.sh user user
#!/bin/sh user=$1 group=$2 root='root' main='admin' upath='/var/www/'${user}'/data' upathw='/var/www' phpbin='php-bin' phpbin56='php-bin-isp-php56' php='php' phpini='php.ini' phpinid='.php.ini' printf "TEST MISSING DIRECTORY PHP-BIN HOME\n" if test -d "${upath}/${phpbin}" ; then echo "OK - FOUND" else echo "CREATE DIRECTORY..." mkdir -p ${upath}/${phpbin} find ${upath}/${phpbin} -type d -print0 | xargs -0 chown ${root}:${root} find ${upath}/${phpbin} -type d -print0 | xargs -0 chmod 0751 echo "CREATE OK" fi printf "TEST MISSING PHP-INI FILE TO DIRECTORY PHP-BIN HOME\n" chksummrootphpini="$(sum ${upathw}/${phpbin}/${main}/${phpini})" chksummuserphpini="$(sum ${upath}/${phpbin}/${phpini})" if test "$chksummrootphpini" = "$chksummuserphpini" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN PHP-INI..." rm -rf ${upath}/${phpbin}/${phpini} cp -r -p -f ${upathw}/${phpbin}/${main}/${phpini} ${upath}/${phpbin} find ${upath}/${phpbin}/${phpini} -type f -print0 | xargs -0 chown ${root}:${root} find ${upath}/${phpbin}/${phpini} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING DOT-PHP-INI FILE TO DIRECTORY PHP-BIN HOME\n" chksummrootphpinid="$(sum ${upathw}/${phpbin}/${main}/${phpinid})" chksummuserphpinid="$(sum ${upath}/${phpbin}/${phpinid})" if test "$chksummrootphpinid" = "$chksummuserphpinid" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN DOT-PHP-INI..." rm -rf ${upath}/${phpbin}/${phpinid} cp -r -p -f ${upathw}/${phpbin}/${main}/${phpinid} ${upath}/${phpbin} find ${upath}/${phpbin}/${phpinid} -type f -print0 | xargs -0 chown ${root}:${root} find ${upath}/${phpbin}/${phpinid} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING PHP FILE TO DIRECTORY PHP-BIN HOME\n" chksummrootphp="$(sum ${upathw}/${phpbin}/${main}/${php})" chksummuserphp="$(sum ${upath}/${phpbin}/${php})" if test "$chksummrootphp" = "$chksummuserphp" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN PHP..." rm -rf ${upath}/${phpbin}/${php} cp -r -p -f ${upathw}/${phpbin}/${main}/${php} ${upath}/${phpbin} find ${upath}/${phpbin}/${php} -type f -print0 | xargs -0 chown ${root}:${root} find ${upath}/${phpbin}/${php} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING DIRECTORY PHP-BIN SAVE\n" if test -d "${upathw}/${phpbin}/${user}" ; then echo "OK - FOUND" else echo "CREATE DIRECTORY..." mkdir -p ${upathw}/${phpbin}/${user} find ${upathw}/${phpbin}/${user} -type d -print0 | xargs -0 chown ${user}:${group} find ${upathw}/${phpbin}/${user} -type d -print0 | xargs -0 chmod 0751 echo "CREATE OK" fi printf "TEST MISSING PHP-INI FILE TO DIRECTORY PHP-BIN SAVE\n" chkssrootphpini="$(sum ${upathw}/${phpbin}/${main}/${phpini})" chkssuserphpini="$(sum ${upathw}/${phpbin}/${user}/${phpini})" if test "$chkssrootphpini" = "$chkssuserphpini" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN PHP-INI..." rm -rf ${upathw}/${phpbin}/${user}/${phpini} cp -r -p -f ${upathw}/${phpbin}/${main}/${phpini} ${upathw}/${phpbin}/${user} find ${upathw}/${phpbin}/${user}/${phpini} -type f -print0 | xargs -0 chown ${user}:${group} find ${upathw}/${phpbin}/${user}/${phpini} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING DOT-PHP-INI FILE TO DIRECTORY PHP-BIN SAVE\n" chkssrootphpinid="$(sum ${upathw}/${phpbin}/${main}/${phpinid})" chkssuserphpinid="$(sum ${upathw}/${phpbin}/${user}/${phpinid})" if test "$chkssrootphpinid" = "$chkssuserphpinid" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN DOT-PHP-INI..." rm -rf ${upathw}/${phpbin}/${user}/${phpinid} cp -r -p -f ${upathw}/${phpbin}/${main}/${phpinid} ${upathw}/${phpbin}/${user} find ${upathw}/${phpbin}/${user}/${phpinid} -type f -print0 | xargs -0 chown ${user}:${group} find ${upathw}/${phpbin}/${user}/${phpinid} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING PHP FILE TO DIRECTORY PHP-BIN SAVE\n" chkssrootphp="$(sum ${upathw}/${phpbin}/${main}/${php})" chkssuserphp="$(sum ${upathw}/${phpbin}/${user}/${php})" if test "$chkssrootphp" = "$chkssuserphp" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN PHP..." rm -rf ${upathw}/${phpbin}/${user}/${php} cp -r -p -f ${upathw}/${phpbin}/${main}/${php} ${upathw}/${phpbin}/${user} find ${upathw}/${phpbin}/${user}/${php} -type f -print0 | xargs -0 chown ${user}:${group} find ${upathw}/${phpbin}/${user}/${php} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING DIRECTORY PHP-BIN-56 HOME\n" if test -d "${upath}/${phpbin56}" ; then echo "OK - FOUND" else echo "CREATE DIRECTORY..." mkdir -p ${upath}/${phpbin56} find ${upath}/${phpbin56} -type d -print0 | xargs -0 chown ${root}:${root} find ${upath}/${phpbin56} -type d -print0 | xargs -0 chmod 0751 echo "CREATE OK" fi printf "TEST MISSING PHP-INI FILE TO DIRECTORY PHP-BIN-56 HOME\n" chks56ummrootphpini="$(sum ${upathw}/${phpbin56}/${main}/${phpini})" chks56ummuserphpini="$(sum ${upath}/${phpbin56}/${phpini})" if test "$chks56ummrootphpini" = "$chks56ummuserphpini" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN PHP-INI..." rm -rf ${upath}/${phpbin56}/${phpini} cp -r -p -f ${upathw}/${phpbin56}/${main}/${phpini} ${upath}/${phpbin56} find ${upath}/${phpbin56}/${phpini} -type f -print0 | xargs -0 chown ${root}:${root} find ${upath}/${phpbin56}/${phpini} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING DOT-PHP-INI FILE TO DIRECTORY PHP-BIN-56 HOME\n" chks56ummrootphpinid="$(sum ${upathw}/${phpbin56}/${main}/${phpinid})" chks56ummuserphpinid="$(sum ${upath}/${phpbin56}/${phpinid})" if test "$chks56ummrootphpinid" = "$chks56ummuserphpinid" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN DOT-PHP-INI..." rm -rf ${upath}/${phpbin56}/${phpinid} cp -r -p -f ${upathw}/${phpbin56}/${main}/${phpinid} ${upath}/${phpbin56} find ${upath}/${phpbin56}/${phpinid} -type f -print0 | xargs -0 chown ${root}:${root} find ${upath}/${phpbin56}/${phpinid} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING PHP FILE TO DIRECTORY PHP-BIN-56 HOME\n" chks56ummrootphp="$(sum ${upathw}/${phpbin56}/${main}/${php})" chks56ummuserphp="$(sum ${upath}/${phpbin56}/${php})" if test "$chks56ummrootphp" = "$chks56ummuserphp" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN PHP..." rm -rf ${upath}/${phpbin56}/${php} cp -r -p -f ${upathw}/${phpbin56}/${main}/${php} ${upath}/${phpbin56} find ${upath}/${phpbin56}/${php} -type f -print0 | xargs -0 chown ${root}:${root} find ${upath}/${phpbin56}/${php} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING DIRECTORY PHP-BIN-56 SAVE\n" if test -d "${upathw}/${phpbin56}/${user}" ; then echo "OK - FOUND" else echo "CREATE DIRECTORY..." mkdir -p ${upathw}/${phpbin56}/${user} find ${upathw}/${phpbin56}/${user} -type d -print0 | xargs -0 chown ${user}:${group} find ${upathw}/${phpbin56}/${user} -type d -print0 | xargs -0 chmod 0751 echo "CREATE OK" fi printf "TEST MISSING PHP-INI FILE TO DIRECTORY PHP-BIN-56 SAVE\n" chks56srootphpini="$(sum ${upathw}/${phpbin56}/${main}/${phpini})" chks56suserphpini="$(sum ${upathw}/${phpbin56}/${user}/${phpini})" if test "$chks56srootphpini" = "$chks56suserphpini" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN PHP-INI..." rm -rf ${upathw}/${phpbin56}/${user}/${phpini} cp -r -p -f ${upathw}/${phpbin56}/${main}/${phpini} ${upathw}/${phpbin56}/${user} find ${upathw}/${phpbin56}/${user}/${phpini} -type f -print0 | xargs -0 chown ${user}:${group} find ${upathw}/${phpbin56}/${user}/${phpini} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING DOT-PHP-INI FILE TO DIRECTORY PHP-BIN-56 SAVE\n" chks56srootphpinid="$(sum ${upathw}/${phpbin56}/${main}/${phpinid})" chks56suserphpinid="$(sum ${upathw}/${phpbin56}/${user}/${phpinid})" if test "$chks56srootphpinid" = "$chks56suserphpinid" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN DOT-PHP-INI..." rm -rf ${upathw}/${phpbin56}/${user}/${phpinid} cp -r -p -f ${upathw}/${phpbin56}/${main}/${phpinid} ${upathw}/${phpbin56}/${user} find ${upathw}/${phpbin56}/${user}/${phpinid} -type f -print0 | xargs -0 chown ${user}:${group} find ${upathw}/${phpbin56}/${user}/${phpinid} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi printf "TEST MISSING PHP FILE TO DIRECTORY PHP-BIN-56 SAVE\n" chks56srootphp="$(sum ${upathw}/${phpbin56}/${main}/${php})" chks56suserphp="$(sum ${upathw}/${phpbin56}/${user}/${php})" if test "$chks56srootphp" = "$chks56suserphp" ; then echo "OK - NOT MODIFIED" else echo "REPLACE BROKEN PHP..." rm -rf ${upathw}/${phpbin56}/${user}/${php} cp -r -p -f ${upathw}/${phpbin56}/${main}/${php} ${upathw}/${phpbin56}/${user} find ${upathw}/${phpbin56}/${user}/${php} -type f -print0 | xargs -0 chown ${user}:${group} find ${upathw}/${phpbin56}/${user}/${php} -type f -print0 | xargs -0 chmod 0751 echo "REPLACE OK" fi exit