# Apache Directory Listing, But Musn't Be Able To Download



## thavinci (Jun 3, 2011)

Ok, so the title might be confusing but this is what I would like to achieve. I would like to have Apache do the usual directory listing on a particalur folder, however, if any user actually tries to download anything it would be denied. In other words all I want is the files to be listed, yet to be undownloadable. I want to do this to show users content on a file server, yet I dont wan't them downloading the content via the web!

Regards


----------



## quintessence (Jun 3, 2011)

Hello,

To deny download via web you can set for example:

`# chmod 600 *` in the document root of the web server.


----------



## thavinci (Jun 3, 2011)

Thank you for the suggestion, but I wouldnt wan't to mess with file system permissions to achieve this as it would affect other applications. Also it isn't a single directory but rather a virtual direcotory setup like DFS in Windows mounting other folder via nullfs. So I wouldn't want to solve it in this fashion.

I did try using a php script, namely dirLIST_0.3.0 to try and achieve this.


----------



## mix_room (Jun 6, 2011)

A dirty solution would be to export a directory listing to index.html
Perhaps do this hourly. The index would be a little old, but not so much. 

`# crontab -e`

```
@hourly ls DIRECTORY > index.html
```

Otherwise, as you already suggested, you might try a PHP or Perl-script 
http://perlmeme.org/faqs/file_io/directory_listing.html


----------



## tingo (Jun 6, 2011)

Or perhaps a full web-based file manager (like Mollify) will have the features you need?
(Note: I haven't used Mollify, so I don't know if it supports "view, don't allow download").


----------

