|
|
|
|
|
|
Password protecting directories |
|
Sometimes it is necessary to password protect a directory for administrative purposes. You can use htaccess to protect a directory and all it's child directories very easily. Your hosting plan must include shell access to do this. First copy the information below into a text file in the directory you wish to protect changing yourusername to your real username and name it .htaccess. AuthUserFile /users/USERNAME/.htpasswd AuthName "Secret stuff" AuthType Basic require valid-user Next, log in via SSH and at the prompt type the following command replacing "username" with the username you prefer: $ /usr/local/bin/htpasswd -c .htpasswd username <HIT ENTER> New password: <TYPE PASSWORD> Re-type new password: <TYPE IT AGAIN> After hitting enter you will be prompted to enter the password for the username and then asked to repeat it. This will generate an encrypted password file outside of your web space where only the .htaccess file can read it. The "." placed before the file name makes the file "invisible" to web browsers and telnet clients. To see the file after it's generated you must use the command "ls -a" at the prompt, which means "list -all" allowing you to view hidden files. |
|
|
|
Web-1 Hosting, LP 1-888-WEB-1HOSTING (888-932-1467) |
|