Permissões de arquivos / pastas do Joomla no Ubuntu

1

A maneira recomendada de definir permissões de arquivos e pastas no diretório raiz do joomla é a seguinte (no site help.ubuntu)

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

Alguém pode explicar o propósito do {} e do \ nas duas instruções chmod acima?

    
por pkaramol 05.06.2014 / 12:41

1 resposta

0

o comando find retorna uma lista de arquivos, e o parâmetro -exec executa em cada arquivo listado o comando chmod 644 . Os colchetes permitem que o usuário especifique onde no comando é usado o nome do arquivo listado ...

o \; é usado para especificar o final do comando (neste caso, o fim do comando chmod )

veja 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.

link

    
por pataluc 05.06.2014 / 13:10