chargin8 — 2011-08-09T01:41:24-04:00 — #1
I want to have about 20 files available for download, each one needs a different password. Im using a VPS WHM server. I know how to password protect a directory but Im hoping theres something I can do to just a file. Preferably without a username, just a password.
Doesnt need to be bullet proof...
spacephoenix — 2011-08-09T02:40:08-04:00 — #2
Do you have any info about the files stored in a database? If so you could add a field for password and have the server-side language (which one?) you're using check that the person is logged in and that the password they submit is the valid password. Possibly you might want to log all attempts to download a file (possibly ip address, username, date and time) so you can keep an eye out for anything suspicious
chargin8 — 2011-08-09T02:45:30-04:00 — #3
Sounds great but Im not really able to program that sort of thing. I only have very basic php skills..
I was hoping there might be something within Cpanel or something I could install like a script or similar that would do it.
matlib — 2011-08-09T08:13:07-04:00 — #4
Storing in a database is by far the most effective way to accomplish this. However if you are looking for a simple solution, try using a .htaccess file to password lock each file. Below is a simple example, change it to suit you exact needs.
AuthName "Name of Page"
Change: /path/to/htpasswd/file/.htpasswd to the full path to the .htpasswd file you have created with the login details.
Change "mypage.html" to the filename of the page you're protecting.
Hope that helps.
chargin8 — 2011-08-09T08:39:06-04:00 — #5
Aha that might be something I can use, thanks.
chargin8 — 2011-08-09T21:06:00-04:00 — #6
Can this htaccess method work with say 10 different files and a different username and password for each file though?
Ive got it set up with 1 file and it works great, but I tried to add a second file but cant see how that would work, seems once you are logged in all the files are accessible.
chargin8 — 2011-08-09T21:10:21-04:00 — #7
require user test
require user test2
The above allows multiple files with a single user/pass each