Password protected directrories

Password protection restricts access to particular folder. Only authenticate users can access password protected folder.

 

Here are few steps with which you can enable password protection

 

1)Login to cPanel.

2)Click on icon Password Protect Directories. Directory Selection window will appear. 3)Click on radio button of web root and then click on Go button.

4)Click on folder name for which you wish to enable password protection.

5)Enable checkbox Password protect this directory.

6)Put proper name in the field Password protect this directory and click on save button.

 

Here you done with the password protection.

 

Now you need to add user with the password to access protected folder.

 

7)In the field username put username

8′) Then put the password in New password field, repeat the password  in Password (Again) field and then click on button Add/modify authorized user

Now try the URL just to confirm that password protection is working for desired folder. If you see username / password prompt then it indicate that password protection is enabled.

 

Quick steps to enable password protection from shell.

 

Create .htaccess file in folder which you wish to make it password protected and put the following content

 

AuthName “Restricted Area”
AuthType Basic
AuthUserFile /home/username/.htpasswd
<Limit GET POST PUT>
Require valid-user
</Limit>

 

Username should be cPanel user of the domain.

 

Now type the following command in shell to add username and password

 

htpasswd -c /home/username/.htpasswd testuser.

 

In apache 2.2 you may need to use absolute path of htpasswd, /usr/local/apache/bin/htpasswd

That will be prompted for new password. Put the desired password.

The newly username and password will be saved in /home/username/.htpasswd

Now open browser to access secure part of the webite just to ensure that you are prompted for username and password.

 

 

 

Related Posts:

  • No Related Posts

Comments are closed.