Per-file control is not available. Password protection can only be applied to a directory (folder); the password will apply to all the contents of that directory.
To protect an individual file, put the file into a directory by itself.
Before setting up password protection, ITD recommends that you understand the following:
The following steps will be completed in the directory you want to protect. The steps will be repeated for each directory you wish to protect.
frank $ cd directory name
frank $ pico .htaccess (This creates the file then opens it in pico)
AuthName cannot contain any empty spaces. If a space is needed, substitute an underscore (
_ ) character. AuthUserFile complete path to your protected subdirectory /.htpasswd AuthGroupFile /dev/null AuthName your name, course, organization, etc... AuthType Basic <Limit GET> require user list authorized person(s) here </Limit> AuthUserFile /users/faculty/johndoe/public_html/classfile/.htpasswd
AuthGroupFile /dev/null
AuthName ProfessorSmart
AuthType Basic
<Limit GET>
require user John Smith
</Limit>
The file "classfile," located in Professor Smart's public_html folder, is available
to John Smith.
The following command will create the encrypted password and a hidden file named .htpasswd. Username refers to the person receiving your permission to access the file ("John Smith" in the above example). The names should match exactly.
frank $ /usr/local/etc/httpd/support/htpasswd -c .htpasswd username
Change the permissions of the .htaccess and .htpasswd files to allow all users to
read and execute them.
frank $ chmod a+rx .htaccess
frank $ chmod a+rx .htpasswd