Why can't apache access files in /tmp?

Chris Green cl at isbd.net
Tue Oct 30 15:37:19 UTC 2018


On Tue, Oct 30, 2018 at 03:00:25PM +0000, Colin Law wrote:
>    On Tue, 30 Oct 2018 at 14:51, Chris Green <[1]cl at isbd.net> wrote:
> 
>      On Tue, Oct 30, 2018 at 01:39:13PM +0000, Colin Law wrote:
>      >    On Tue, 30 Oct 2018 at 13:33, Chris Green <[1][2]cl at isbd.net>
>      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.
>      >
>      >    Could possibly be that the apache systemd script specifies
>      privateTmp
>      Yes, I think that's it (or at least it's something to do with
>      systemd).  Whatever, it's a real nuisance.
> 
>      Where can I put files that apache can 'see' and which will get
>      cleared
>      out at intervals?
> 
>    It should be easy enough to change the systemd startup script, it will
>    likely be in /etc/systemd/system.  Make a copy of it with a different
>    name and edit that, then disable the usual one and enable yours.  If
>    you don't make a copy then it will get overwritten when you update.
>    I did see mention that there could be security risks with that though,
>    so you might like to check on that.

Yes, I read this elsewhere but there doesn't seem be have any reference
to apache or tmp in any of the files in /etc/systemd.  There is a
directory systemd-private-e0d672d5d6814aed8f48c266641180ea-apache2.service-BDQ84c
in /tmp though.


>    Otherwise put the files somewhere else and have a cron script that
>    cleans it occasionally.

I think this may be the best way.

-- 
Chris Green




More information about the ubuntu-users mailing list