I want to put some temporary html files in /tmp (well, a sub-directory of /tmp) and view them using apache2. I always get permission denied and it seems as if apache2 refuses to access any files in /tmp.
I have a very simple apache2 set up with the root set to /srv with an entry as follows:-
<Directory /srv/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
I add symlinks to /srv to get access to files around the system, it works for every directory I've tried (even including such places as /etc) but *not* for /tmp. (I've removed all the odd symlinks again of course!)
What's so special about /tmp? I've searched for references to tmp in the apache configuration but there's nothing there.
Can anyone suggest what the issue is?
Alternatively where can I put a file that will get cleaned out periodically (like /tmp at reboot)?
On Tue, Oct 30, 2018 at 01:26:02PM +0000, Chris Green wrote:
I want to put some temporary html files in /tmp (well, a sub-directory of /tmp) and view them using apache2. I always get permission denied and it seems as if apache2 refuses to access any files in /tmp.
I have a very simple apache2 set up with the root set to /srv with an entry as follows:-
<Directory /srv/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
I add symlinks to /srv to get access to files around the system, it works for every directory I've tried (even including such places as /etc) but *not* for /tmp. (I've removed all the odd symlinks again of course!)
What's so special about /tmp? I've searched for references to tmp in the apache configuration but there's nothing there.
Can anyone suggest what the issue is?
After some more web searching I *think* this is another (unwanted?) systemd thing. It means that apache (and some other things) has its own temporary directory so that references to /tmp in apache go to some /tmp/systemd-private<something> directory instead.
What a pain!
Alternatively where can I put a file that will get cleaned out periodically (like /tmp at reboot)?
This question still stands, where can a program write temporary files so that apache can display them?
On 30/10/2018 14:21, Chris Green wrote:
[SNIP]
Alternatively where can I put a file that will get cleaned out periodically (like /tmp at reboot)?
This question still stands, where can a program write temporary files so that apache can display them?
I use a tool call tmpreaper to clear out certain directories on a regular basis. It works really well in cron:
# Run tmpreaper to clear amavis 12h old temporary files every 4 hours # This is needed in /var/amavis/tmp as it fills up so quickly # 00 */4 * * * /usr/sbin/tmpreaper 12h --ctime /var/lib/amavis/tmp/ 2>&1
# The quarantine can be cleared of week old files daily 00 02 * * * /usr/sbin/tmpreaper 7d --ctime /var/lib/amavis/virusmails/ 2>&1
https://packages.debian.org/sid/tmpreaper
[Heed the / warnings!]
http://manpages.ubuntu.com/manpages/trusty/man8/tmpreaper.8.html
Cheers, Laurie.
On Tue, Oct 30, 2018 at 02:29:39PM +0000, Laurie Brown wrote:
On 30/10/2018 14:21, Chris Green wrote:
[SNIP]
Alternatively where can I put a file that will get cleaned out periodically (like /tmp at reboot)?
This question still stands, where can a program write temporary files so that apache can display them?
I use a tool call tmpreaper to clear out certain directories on a regular basis. It works really well in cron:
# Run tmpreaper to clear amavis 12h old temporary files every 4 hours # This is needed in /var/amavis/tmp as it fills up so quickly # 00 */4 * * * /usr/sbin/tmpreaper 12h --ctime /var/lib/amavis/tmp/ 2>&1
# The quarantine can be cleared of week old files daily 00 02 * * * /usr/sbin/tmpreaper 7d --ctime /var/lib/amavis/virusmails/ 2>&1
https://packages.debian.org/sid/tmpreaper
[Heed the / warnings!]
http://manpages.ubuntu.com/manpages/trusty/man8/tmpreaper.8.html
Thanks Laurie, though for my one-off case I could simply run find directly to removee files more than a few days old. However the less I have to customise my system the better and I include extra cron jobs as customisation (though fairly minor I agree).`
On 30/10/2018 14:40, Chris Green wrote:
[SNIP]
Thanks Laurie, though for my one-off case I could simply run find directly to removee files more than a few days old. However the less I have to customise my system the better and I include extra cron jobs as customisation (though fairly minor I agree).`
I have standard build procedures for all my machines, all slightly different according to the role it will play, and for the spam filters, it includes tmpreaper for temp files.
I don't regard it as customisation! It's a machine fit for purpose. It's one of the drivers behind tools like Ansible.
JFDI!
Cheers, Laurie.
On Tue, 30 Oct 2018 14:51:09 +0000 Laurie Brown laurie@brownowl.com allegedly wrote:
I don't regard it as customisation! It's a machine fit for purpose. It's one of the drivers behind tools like Ansible.
JFDI!
Wow! :-)
--------------------------------------------------------------------- Mick Morgan gpg fingerprint: FC23 3338 F664 5E66 876B 72C0 0A1F E60B 5BAD D312 https://baldric.net/about-trivia ---------------------------------------------------------------------
On Tue, 2018-10-30 at 13:26 +0000, Chris Green wrote:
I want to put some temporary html files in /tmp (well, a sub-directory of /tmp) and view them using apache2. I always get permission denied and it seems as if apache2 refuses to access any files in /tmp.
I have a very simple apache2 set up with the root set to /srv with an entry as follows:-
<Directory /srv/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
I add symlinks to /srv to get access to files around the system, it works for every directory I've tried (even including such places as /etc) but *not* for /tmp. (I've removed all the odd symlinks again of course!)
What's so special about /tmp? I've searched for references to tmp in the apache configuration but there's nothing there.
Can anyone suggest what the issue is?
Is your apache running chroot'd?