Secure File Hosting from your Website

From CS Support
Jump to: navigation, search

Secure File Hosting

With your website you can actually control access to the files with in your directories.

To install htpasswd support on your local system you will need the apache2-utils package installed (in ubuntu).


Using htpasswd

First create the directory you want to control access to. Then create a .htaccess file within the created directory.

Populate the information as you need. A sample is below:

 AuthName "Restricted Area"
 AuthType Basic
 AuthUserFile /<path>/<to>/<directory>/.htpasswd
 AuthGroupFile /dev/null
 require valid-user

Notice it is looking for .htpasswd

To create the .htpasswd file from the command line in linux use the below command:

htpasswd -b -c /<path>/<to>/<directory>/.htpasswd <username to use> <password to encrypt>