title: Joomla folder permission denied
body: <p>I've a problem with folder permission on Joomla.
  I run Joomla 3.7 on Apache+php-fpm (7.0) on Linux Centos 7 and all folder are set to the user the run apache and php-fpm (hotel:hotel).
  All dir are chmod 755 and all file chmod 644.</p>
  
  <p>This is my folder structure:</p>
  
  <pre><code>drwxr-xr-x. 11 hotel hotel      159 22 mag 10.49 administrator
  drwxr-xr-x.  2 hotel hotel       44 22 mag 10.49 bin
  drwxr-xr-x.  2 hotel hotel       24 22 mag 10.49 cache
  drwxr-xr-x.  2 hotel hotel      119 22 mag 10.49 cli
  drwxr-xr-x. 19 hotel hotel     4096 22 mag 10.49 components
  -rw-r--r--.  1 hotel hotel     1959 18 giu 12.52 configuration.php
  -rw-r--r--.  1 hotel hotel     3005 22 mag 10.49 htaccess.txt
  drwxr-xr-x.  5 hotel hotel      118 22 mag 10.49 images
  drwxr-xr-x.  2 hotel hotel       64 22 mag 10.49 includes
  -rw-r--r--.  1 hotel hotel     1420 22 mag 10.49 index.php
  -rw-r--r--.  1 hotel hotel       20 17 giu 12.59 info.php
  -rw-r--r--.  1 hotel hotel 12714184 17 giu 12.16 joomla.zip
  drwxr-xr-x.  5 hotel hotel       67 23 mag 15.47 language
  drwxr-xr-x.  5 hotel hotel       70 22 mag 10.49 layouts
  drwxr-xr-x. 11 hotel hotel      255 22 mag 10.49 libraries
  -rw-r--r--.  1 hotel hotel    18092 22 mag 10.49 LICENSE.txt
  drwxr-xr-x. 26 hotel hotel     4096 22 mag 10.49 media
  drwxr-xr-x. 27 hotel hotel     4096 22 mag 10.49 modules
  drwxr-xr-x.  2 hotel hotel       30 17 giu 12.15 php-fcgi-scripts
  drwxr-xr-x. 16 hotel hotel      250 22 mag 10.49 plugins
  -rw-r--r--.  1 hotel hotel     4494 22 mag 10.49 README.txt
  -rw-r--r--.  1 hotel hotel      836 22 mag 10.49 robots.txt.dist
  drwxr-xr-x.  5 hotel hotel       68 22 mag 10.49 templates
  -rw-rw-r--.  1 hotel hotel      264 18 giu 14.24 test.php
  -rw-r--r--.  1 hotel hotel      346 17 giu 13.03 testu.php
  drwxr-xr-x.  4 hotel hotel      246 17 giu 13.21 tmp
  -rw-r--r--.  1 hotel hotel     1690 22 mag 10.49 web.config.txt
  </code></pre>
  
  <p>From Joomla panel only configuration.php and administrator/logs seems to be writable. All the other folders are not writable as shown below</p>
  
  <p><a href="https://i.stack.imgur.com/sXZuB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sXZuB.png" alt="joomla system informations"></a></p>
  
  <p>I've tested this php script:</p>
  
  <pre><code>&lt;?php
      $root = getcwd();
  
      echo exec('whoami')." ";
      echo "$root ";
  
      echo is_readable("/var/www/html/cache") ? 'yes ' : 'no ';
      echo is_writable("/var/www/html/cache") ? 'yes ' : 'no ';
  
      echo is_writable("/tmp") ? 'yes ' : 'no ';
  ?&gt;
  </code></pre>
  
  <p>This is the browser output:</p>
  
  <pre><code>hotel /var/www/html yes no yes
  </code></pre>
  
  <p>What could be the reason?</p>
  
  <p><strong>I solved setting up SeLinux in this way</strong></p>
  
  <pre><code>sudo chcon -R -t httpd_sys_rw_content_t /var/www/html
  </code></pre>