Druap 10 Permission denied in Drupal\Core\File\FileSystem

By admin, 9 June, 2024
Warning: rmdir(/sites/default/files/css): Permission denied in Drupal\Core\File\FileSystem->rmdir() (line 267 of core/lib/Drupal/Core/File/FileSystem.php). Warning: unlink(/sites/default/files/js/js_ySk0KASHae4u0xMZpi2R9zGpyyhk0Np-ZS9YY7e7xVQ.js): Permission denied in Drupal\Core\File\FileSystem->unlink() (line 124 of core/lib/Drupal/Core/File/FileSystem.php).

It looks like there are permission issues that need to be addressed. Let's try to resolve these by ensuring the correct permissions and ownership are set on the entire /sites/default/files directory and its subdirectories.

  1. Set Correct Ownership for the Entire Files Directory: Ensure the web server user (usually www-data for Apache on Ubuntu) owns the files and directories.

    sudo chown -R www-data:www-data /var/www/html/drupal/web/sites/default/files
  2. Set Correct Permissions for the Entire Files Directory: Set the correct permissions for the directories and files to ensure they are writable by the web server.

    sudo find /var/www/html/drupal/web/sites/default/files -type d -exec chmod 755 {} \; sudo find /var/www/html/drupal/web/sites/default/files -type f -exec chmod 644 {} \;
  3. Verify Permissions: Check the permissions to ensure they have been applied correctly.

    ls -l /var/www/html/drupal/web/sites/default/files
  4. Clear Cache: Now, try to clear the cache again using Drush.

    drush cr

     

Category

Comments