Joomla Файлы / Разрешения для папок в Ubuntu

Рекомендуемый способ установки разрешений для файлов и папок в корневом каталоге joomla заключается в следующем (с веб-сайта help.ubuntu)

cd /var/www/joomla/
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;

Кто-нибудь может объяснить назначение {} и \ в двух приведенных выше инструкциях chmod?

1 ответ

Решение

find команда возвращает список файлов, а -exec Параметр выполняет для каждого перечисленного файла команду chmod 644, Скобки позволяют пользователю указать, где в команде используется указанное имя файла...

\; используется для указания конца команды (в этом случае конец chmod команда)

увидеть man find:

   -exec command ;
      Execute  command;  true  if 0 status is returned.  All following
      arguments to find are taken to be arguments to the command until
      an  argument  consisting of ';' is encountered.  The string '{}'
      is replaced by the current file name being processed  everywhere
      it occurs in the arguments to the command, not just in arguments
      where it is alone, as in some versions of find.  Both  of  these
      constructions might need to be escaped (with a '\') or quoted to
      protect them from expansion by the shell.  See the EXAMPLES sec-
      tion  for examples of the use of the '-exec' option.  The speci-
      fied command is run once for each matched file.  The command  is
      executed  in  the  starting  directory.    There are unavoidable
      security problems surrounding  use  of  the  -exec  option;  you
      should use the -execdir option instead.

http://unixhelp.ed.ac.uk/CGI/man-cgi?find

Другие вопросы по тегам