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...
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
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.
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.
Aha that might be something I can use, thanks.
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.
require user test
require user test2
The above allows multiple files with a single user/pass each