Password Protect Web Page |
|
Back to Technical FAQ |
To accomplish this, two files are required:
- .htaccess
- .htpasswd
AuthUserFile /home/foo/public_html/.htpasswd AuthName Toolbox Example AuthType Basic <Limit GET> require valid-user </Limit>You will have to modify the first line, giving the complete path for your .htpasswd file. The bottom three lines indicate that a valid user is required for accessing the website where .htaccess is located. Following is a sample .htpasswd file, each line specifies a userid/encrypted password.
foo:.5yVOkTkyRznThree ways to generate the password line in .htpasswd are:
- If you have access to the htpasswd command you can use the below command. The system will ask you to type in the password.
htpasswd -c /home/foo/public_html/.htpasswd foo
- You can use perl's crypt function: perl -e 'print crypt("foopasswd",".,5yVOkT.kyRzn")' You can type whatever string you prefer in the second argument.
