In Drupal 8, a private file system path should be writable by Drupal but not accessible over the web. This path is used to store private files and it shouldn't be part of the Drupal installation directory.
I need to set this up for the Backup and Migrate module. It needs a Private Files Directory.
Set private file system path
Open your .../sites/default/settings.php and set an absolute path to the variable $settings['file_private_path']
.
Test private file system
To check that the private file system path is set correctly. Navigate to Configuration > File system and then check the followings:
- Private file system path matches what you set in settings.php.
- You get the new Private local files served by Drupal option under Default download method section.
Also, Drupal should create a .htaccess file in your private folder.
Errors
In case that your test of the private file system path failed and that you get the following errors:
Not fully protected
See https://www.drupal.org/SA-CORE-2013-003 for information about the recommended .htaccess file which should be added to the private:// directory to help protect against arbitrary code execution.
or
Your private:// stream is not configured.
These errors are triggered because your private directory was not created prior to setting the variable $settings['file_private_path']
.
To resolve this issue:
- Run cron from Configuration > Cron.
- Clear your cache from Configuration > Performance.