Go to content Go to menu Go to search

Скрипт установки прав на папку web рекурсивно

SetPermissionsOnWWW.sh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /bin/bash
set -o noglob

USER='greenadmin'
GROUP='www-data'


setPerm() {
    echo "Doing work on ${WWW_DIR}"
    cd $WWW_DIR

    echo "Set owner to files.."
    find . ${EXCLUDE} -type f -exec chown $USER:$GROUP {} \;

    echo "Set permissions to files.."
    find . ${EXCLUDE} -type f -exec chmod 644 {} \;

    echo "Set permissions to folders.."
    find . ${EXCLUDE} -type d -exec chmod 755 {} \;

    echo "Set owner to folders.."
    find . ${EXCLUDE} -type d -exec chown $USER:$GROUP {} \;
}

WWW_DIR='/var/www/html/site1'
EXCLUDE='-mount -not -path ./_cache* -not -path ./_temp* -not -path ./_data*'
setPerm

WWW_DIR='/var/www/html/site2'
EXCLUDE='-mount -not -path ./_cache* -not -path ./_temp* -not -path ./_data* -not -path ./logs'
setPerm


при публикации материалов с данного сайта обратная ссылка на сайт обязательна.
valynkin.ru © no rights reserved