|
Hi
You can password protect a directory easily as follows. Let us consider we need to password protect the directory /home/username/public_html/sample
1) Change directory to /home/username/public_html/sample using cd command
cd /home/username/public_html/sample
2) Create .htaccess file
touch .htaccess [if it is already there you can use it no need to create one]
3) Add the following line to the .htaccess file
AuthUserFile /home/username/public_html/sample/.htpasswd
AuthName "Title for Protected Site"
AuthType Basic
Require valid-user
4) Create .htpasswd file in the same directory as .htaccess
touch .htpasswd
5) Create the password file using the following command.
htpasswd -c .htpasswd username
New password:
Re-type new password:
Adding password for user username
That's it you are done!!
<link drop removed >
Last edited by chrishirst; 08-26-2008 at 11:01 AM..
|