# Apache and "dynamic" security, kinda

## VinzC

Hi all.

I'd like to secure a folder with files with each file being accessible by one user only, whose name equals the file name. How can I achieve this with Apache?

For instance, in location /calendars there are

```
user1.ics

user2.ics

...

usern.ics
```

and I'd like user1.ics to be read by user1 only, user2.ics by user2 only, aso.

Thanks in advance.

----------

## Hu

I believe mod_authz_owner will do what you want, if you make the ICS file owned by the user it is named after.

----------

## VinzC

Thanks for the tip Hu. Will the owner be preserved if the web server is also supposed to write to the file? Calendar files are updated through PHPiCalendar.

----------

## Hu

That depends on how PHPiCalendar modifies the files.  The typical way of doing so would not preserve ownership, but it can be done.  I suggest trying a test run of PHPiCalendar to see what it does in that situation.

----------

