On a fresh install of 8.3.7 running on Dreamhost shared hosting, I get a warning at /admin/reports/status advising of this:
TEMPORARY FILES DIRECTORY
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 /tmp directory to help protect against arbitrary code execution.
Problems:
- The linked site is for Drupal 6 and 7. It does not provide obvious guidance for Drupal 9 and 10 users.
- I assume we should use the .htaccess file recommended for Drupal 7. It appears I have to copy code from two separate parts of the page to get the recommended .htaccess file.
- The warning doesn't tell me where the temp directory even is. Had I seen that, I would have immediately noticed it's using the shared /tmp for the whole server.
Expectation: warning messages link to useful pages. Unlike the page actually linked, useful pages provide clear guidance and "don't make me think" solutions. Also, the warning message here should advise me where the temp directory actual is. Don't make me hunt across the configuration to find this.
I'm filing this as a bug because I am confident that this isn't in line with Drupal's commitment to good UX.
Proposed solution
- Create an updated documentation page on Drupal.org that explain how to fix this problem in plain language: (done).
- Replace the stream wrapper
temporary://with the actual file system path. Done. - Replace the link to the SA with a link to this documentation page in the warning displayed in the status report. Done.
Remaining tasks
- Reroll patch in #23 for Drupal 11.
- Address points raised in #27.
- Review the revised patch.
- After it reaches RTBC, commit to the next release.
User interface changes
Before

After

| Comment | File | Size | Author |
|---|---|---|---|
| #44 | before.png | 27.37 KB | quietone |
| #44 | sample.png | 18.46 KB | quietone |
Issue fork drupal-2906490
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
aren cambre commentedComment #3
cilefen commentedComment #4
gagarine commentedUsability is preferred over UX, D7UX, etc. See https://www.drupal.org/issue-tags/topic
Comment #5
David_Rothstein commentedYes it does, it's right there in the message (in italics): "....for information about the recommended .htaccess file which should be added to the /tmp directory to help protect against...."
Is there a way to make this more clear?
I'm also linking to another issue that would make this message go away altogether in many cases, but it's definitely still worth improving the documentation here for the cases where it does need to be displayed.
Comment #6
David_Rothstein commentedPerhaps something like "... which should be added to your site's temporary files directory (located at /tmp) to help protect against..." would be better?
Comment #7
LinuxETC commentedCame across this post thanks to David Snopek (Drupal Security Team).
Recently encountered this same message on Drupal 8.8.2 after the upgrade from 8.8.1 (manually via tarball) where this issue was not noted with 8.8.1.
On a parallel system (the difference is Ubuntu versus CentOS (=issue here system) as the LAMP stack OS), this is not showing up though. I find this a bit odd and unusual since minus the OS layer, the Drupal stack, site, and modules are nearly identical.
Questions and/or feedback are welcomed. Thanks in advance.
Comment #10
frazacSame issue here v. 8.9.3
I have a private folder outside from the web root folder, both on local and production server.
I have tried to use the drupal 7 htaccess with no results.
How to solve this error?
Comment #11
elioshThe same here with drupal 9.1.9
Comment #14
gisleThis persists in Drupal 9.3.3.
As for comment #5 by David_Rothstein:
In version 9.3.3 the warning message has become:
Notice that the path
/tmpis replaced by the stream wrappertemporary://, and if you're not familiar with stream wrappers, you'll have a hard time figuring out where the temp directory is.I think this is worth fixing. While most Drupal alumni should be able to figure it out, it is frustrating for our new community member to be hit by such unhelpful guidance when this one bites them.
So I'll have a go at fixing this core issue. My plan is:
system.install).Suggestions for a suitable location for this documentation page will be appreciated.
Other feedback shall also be appreciated. I won't move status to "Needs review" until I've actually done this.
Comment #15
gisleI've added a documentation page about how to fix this that I hope is more up to date than SA-CORE-2013-003:
Please visit: https://www.drupal.org/docs/installing-drupal/temporary-files-directory-...
If you think it can be improved, please tell me, or Be Bold, just go ahead and improve it yourself, by pressing "Edit".
Comment #16
gisleI also think that the stream wrapper (
temporary://) is not helpful. Users want to see what directory they need to look in, 'I also think the link to the SA is not helpful. I've linked to it on the documentation page, but shall remove from the warning.
So the plan now becomes:
temporary://with the actual file system path.Added this to the issue summary under the heading "Proposed solution"
Comment #17
gisleComment #18
gisleUploaded patch.
Please review.
Comment #19
gisleFixed CS errors and uploaded new patch.
Please review.
Comment #20
gisleDrupal 8 (referenced in the issue summary) is past EOL.
Comment #21
larowlanThis message is being output for public, private and temporary (see ::defaultProtectedDirs) so I don't think to a documentation page specifically about temporary files.
Can we make that page generic enough to cover all three cases?
Comment #22
larowlanComment #23
gisleI've edited the documentation page to say it is about the path to public, private and temporary directories - please see https://www.drupal.org/docs/installing-drupal/some-directory-not-fully-p... and review.
Since the title is changed, the patch has been rerolled to reflect that.
Comment #24
robloachHaving an
.htaccessfile won't help you if you're using nginx, or any other web server out there. This assumes Apache currently... Hmmm.Comment #26
gisleUpdated issue summary to reflect status.
@RobLoach There is another issue about handling this on non-Apache: #3117665: Only show the error “Public files directory Not fully protected” for Apache servers
The current plan is to remove the warning. Not sure if that the best approach, but I'm an Apache-user. It should be sorted out by those using nginx, etc.
Comment #27
larowlan* we've got a weird additional indent here
* let's just inline @doc into the translation string so the additional context is there for translators
* we're still hard-coding ::getTempDirectory for %directory, but we're in a loop at this point which is evaluating whether or not the .htaccess is in more than one place. Can we use the directory from the loop instead?
There's a string change here so this can only go into a minor.
Tagging for translators
Comment #28
larowlanComment #29
dqdTesting on D 9.5.7. ....
1. Error message leads to the wrong docs and finding this issue is a question of luck. Found it by checking if it already exist or needs to be created and then by finding a link in another issue leading to here.
2. After reading thru the issue it creates the impression the correct doc link is this: https://www.drupal.org/docs/installing-drupal/some-directory-not-fully-p...
3. This doc page states that removing a possible outdated .htaccess file will make Drupal to recreate it after entering the file management settings page in admin area. This is partly true and only happens if you run cron.
4. The .htaccess file created by Drupal after that will cause the same error message again. So still not save yet? Warning level in reports is high.
Comparing the created .htaccess file with other .htaccess which do not throw errors yet, shows following difference:
Which all propably needs another issue since this here is only regarding the error message doc link. It also needs to be reported there then that different server enviroments handle mod_php different. The version of mod_php(x) used can have no number if default or can have a number even if still default. (mod_php vs mod_php7) - It also depends on if the server has multiple php versions available which can be switched via update-alternatives and similar tools (useful to have old Drupal projects running not supporting php 8 yet).
Comment #30
dqdSince this is a security warning I partly agree on the issue status since this issue let users run in circles with no avail. I strongly recommend to add a temporary section to the docs linked to in the warning leading to here. The warning level in the admin reports is high so it isn't just a "notification".
Comment #32
gisleIn comment #29, diqidoq objects:
This is not my experience. I've tested it and found that:
If the directory in question is writeable by the web server, the
.htaccessdon't already exists, the correct one is created automatically when the site administrator visits the file system configuration page.This is really bad UX folks. Please see this support forum post for a recent example.
Setting it back to "Needs review". If you really think it "Needs work, please list remaining tasks in the issue summary.
Comment #33
cilefen commentedA core committer commented with desired changes in #27 yet I don't see any patches since that, nor comments addressing those points.
Comment #34
gisleUpdated issue summary with current status.
Comment #35
smustgrave commented#33 mentioned the changes that should be addressed
Comment #36
gisle#33 doesn't mention any changes, it just refererences #27. As for #27, it mentions three changes, summarized below:
I've no idea what is meant by the first one, so I am unable to address this.
However, items #2 and #3 look sensible.
Anyway, in the meantime, development has moved from Drupal 9 to Drupal 11, and patch in #23 no longer applies.
Comment #38
quietone commentedConvert to an MR, and made changes. I hope they are useful. Also trying for a better commit message.
Comment #40
smustgrave commentedOpened the MR and pipeline is green.
Left 1 comment but not sure enough to warrant holding the ticket.
From what I can tell issues from #27 have been addressed, don't miss code reviews via comments at all.
Comment #41
longwaveAdded some questions/comments.
Comment #42
quietone commentedI updated the doc page and the displayed message.
Comment #44
quietone commentedComment #45
smustgrave commentedBelieve feedback from @longwave has been addressed here. Also seeing the same as the screenshots provided.
Comment #46
sivaji_ganesh_jojodae commentedBecause of prevailing merge error.