В следующем сценарии оболочки:
default_conf_file_path="/etc/apache2/sites-available/";
default_conf_file=$default_conf_file_path"000-default.conf";
DocumentRoot=$(grep "DocumentRoot" $default_conf_file);
DocumentRoot=${DocumentRoot#*/};
DocumentRoot=/$DocumentRoot;
usermod -a -G www-data $(whoami); #modify existing user account by associating it with www-data group
chown -R www-data:www-data $DocumentRoot; #change the owner of /var/www/html to www-data and the group identifier to www-data
find $DocumentRoot -type d -exec sudo chmod 2775 {} \;
find $DocumentRoot -type f -exec sudo chmod 0664 {} \;
Я пытаюсь дать полномочия всем каталогам как 2775
и файлы как 0664
. Но полученный набор полномочий является тем же для файлов и каталогов:
Однако files
это позже сгенерировано, динамично имеют соответствующие полномочия rw-r--r--
Почему это? Набор полномочий всех файлов должен быть rw-r--r--
ls -la
вывод из каталога я действую:
drwxr-xr-x 5 www-data www-data 4096 Mar 22 08:18 .
drwxr-xr-x 3 root root 4096 Mar 22 08:16 ..
drwxrwxrwx 7 www-data www-data 4096 Mar 21 11:02 Common
-rw-r--r-- 1 www-data www-data 11510 Mar 22 08:16 default_apache2.html
-rwxrwxrwx 1 www-data www-data 48 Mar 22 08:11 index.php
drwxrwxrwx 17 www-data www-data 4096 Mar 22 08:18 PC
-rwxrwxrwx 1 www-data www-data 1226 Mar 21 11:02 p.php
drwxrwxrwx 2 www-data www-data 4096 Mar 21 11:02 temp
Содержание /etc/apache2/sites-available/000-default.conf
(удаленные строки комментария):
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<Directory /var/www/html>
Options All
AllowOverride All
</Directory>