How to password protect directories
The password protection feature of your SiteAdmin/cPanel allows you to restrict the general public from accessing specified folders/directories within your website.
Before we show you how to enable/disable the service its important to understand how password protection on a folder works. When you choose to password protect a directory in your control panel, SiteAdmin/cPanel will create a rule in your .htaccess file. This rule specifies that the folder is protected and the visitor will need to provide a valid username and password to log in and view the files.
Note: When you grant access through password protection, you are not only granting access for that folder, but any subfolders located within it. Also, by password protecting a directory and gain access to any subfolders in that directory you must provide the login credentials to do so.
Setup Password Protection In SiteAdmin
This demo assumes you’ve already logged in to SiteAdmin
Now let’s see how to setup password protected directories.
Note: If the folder does not presently exist, please create the folder using the FTP program of your choice or using File Manager.
1) Click the Website Tools option from the left menu, then click Password Protect Directories.
2) You can open a directory by clicking the folder icon.
3) Select the directory you wish to protect by clicking on its name.
4) Enter the name you wish people to see on the password popup window. This name will display in the password popup window as pictured below.
5) Click the Enable Password Protection button to turn on password protection. .
6) Now that the directory is protected, we will now create username/password combinations that will allow you or others to access the folder.
Thats it! You successfully added a user to this folder.
If you wish to add more users or remove users from a protected directory simply click on the directory name once again.
1) To add another user simply enter the details and select Add New User
2) You can delete a user by clicking the X next to the users name.
That’s it! You should now be prompted to enter a username/password when accessing the folder via the web.
Setup Password Protection In cPanel
This demo assumes you’ve already logged in to cPanel
Now let’s learn how to password protect a directory, so that people will need a password to view web pages within it
1) Click Password Protect Directories
2) Select the directory to start with, then click Go
3) Select the directory you want to password protect by clicking it’s name
4) Check the Password protect this directory box…
5) Then give a name for the directory, and click Save
The directory is now protected, and requires a password to enter it via a browser
We must therefore create at least one user, and assign them a password to access the directory
8) Then enter and confirm a password
For information on how to create a secure password, please click here.
The protected directory now has one user who has access to it. Repeat this process for each additional user you want to grant access for
You can see the active user for this directory here and can add or delete users from this page at any time
This is the end of the tutorial. You now know how to password protect directories, and assign users to them
Billy Massey March 18, 2015 at 8:05 pm
The protected directory stays open for a long time. Is here a way to limit this?
There is no way to log out. How can I accomplish this?
Is there a way to limit the time that the directory will stay open for a particular user?
James Davey March 19, 2015 at 6:21 am
Hi Billy,
That is not controlled by the server, but by your browser. The authentication is cached, and remains so for a time. Clearing your cache and cookies should force the authentication prompt again.