0

Good day. I have a Server that's running on Ubuntu 14.04 with a LAMP Stack.

So far, I've been able to host webpages on it and it's been working great. However, I want to limit what the users see.

I have a certain directory downloads where I upload files that my clients would need and then just send them the link. The link would look something like: mySite.com/downloads/file.zip.

This works fine, however, when the user goes to mySite.com/downloads, he or she will be able to see all the other folders and files there, and I don't want that to happen.

I went to FileZilla (easiest way for me to do this right now) to set the folder permission to 754, which allows the public to read the folder but not execute. After refreshing, I got a 403 Forbidden on the downloads folder which was expected. However, I can't download the files under it nor access the folders under it as well. I checked and I set the permission of the files and subdirectories to 755 but that did not help.

Is there a way to limit users from accessing the downloads folder while still being able to have access to the subdirectories and files under it?

1 Answer 1

0

Change directory permissions to default 755, create .htaccess file in the /downloads directory and put a line "Option -Indexes" there, as per https://stackoverflow.com/questions/1767785/htaccess-file-options-indexes-on-subdirectories

1
  • This will affect all subdirectories as well. Feb 23, 2018 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.