Overview
You can restrict access to a web folder on your server.
Requirements
Before you start, you will need to have the directory you wish to password protect. If you have not, you will need to create it via FTP or using the File Manager in your Grid Control Panel.
Before you start, you'll need to have handy your FTP user login credentials for your subscripton.
READ ME FIRST
This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by Media Temple. Please take a moment to review the Statement of Support.
READ ME FIRST
This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by Media Temple. Please take a moment to review the Statement of Support.
Instructions
Password protect individual pages
- Log into the WordPress dashboard.
- Select Pages from the menu on the left.
- Hover over the page that you would like to protect and select Quick Edit.
- Locate the password field and type in a password for the page. Alternatively, check the private box to prevent anyone but admins from viewing a particular page.
Password protect entire WordPress
NOTE:
The following will require the installation of a third-party plugin. Please keep in mind that troubleshooting the configuration/functionality of third-party applications is not covered by our statement of support. These resources were provided as a courtesy to assist you to the extent of our abilities. For more information on our statement of support, feel free to click here.
- Log into the WordPress dashboard.
- Click on Plugins >> Add New.
- Install and Activate the Password Protected plugin.
- Click on Settings >> Password Protected.
- Ensure that Password Protect Status and Allow Administrators are enabled. Input a strong password. Then click Save Changes.
- That's it! A password page should now load when you visit your WordPress site.
Password Protect Directory via the AccountCenter
Create your Web Users
- Log into your AccountCenter.
- Click on the blue Admin button associated to your Grid server.
- Click on Password Protect Folders.
- Click on the ADD A NEW WEB USER button.
- Create a username and password.
This user only applies to your password-protected folders. You may also assign a user to a group, if one has already been created.
- Click SAVE. Then continue onto create a Web User Group and Protected Folders.
Optional: Create a Web User Groups
- Click on ADD A NEW WEB GROUP.
- Create a Group Name for your records. Add users to your new group using the drop down menu.
- Click Save. Then continue on to create Protected Folders.
Create your Protected Folders
- Click on PROTECT A NEW FOLDER.
- Clicking on the search bar in the FOLDER section will reveal a menu that you can click through to find your desired directory.
In this example we want to password protect the folder that lives on the web as http://mt-domain.com/restricted. Therefore we navigated to /mt-domain.com/html/restricted.
-
Add a Description for your records. Then select your desired Group and/or User access through the drop down menus.
- Click SAVE.
- Great! You should now have a password protected directory, and a user who will have access to it.
Plesk
- Log into the Plesk Control Panel for your domain.
- Select Password-Protected Directories.
- Click on the Add Protected Directory icon.
- Complete the form. In our example, we create a protected directory called specialdata, entitled PasswordProtect.
- Directory name: The file path / name of the folder you wish to password protect.
- In our example the directory would live on http://mt-website.com/specialdata
- Title of the protected area: A name for your personal records.
- Directory name: The file path / name of the folder you wish to password protect.
- You will be returned to the previous page with a confirmation message.
- We will now create users who will have access to the directory. Click on the directory you just created.
- Click on the Add a User icon.
- Complete the form. Be sure to use a strong password. Click the OK button to save your user.
- Great! You should now have a password protected directory, and a user who will have access to it.
cPanel
NOTE: The following cPanel instructions was created using the theme "paper_lantern." If you are using a different theme, your visuals/instructions may vary.
- Log into the cPanel account for your domain.
- Scroll down to Files. Click on Directory Privacy.
- In this example, we will password protect a directory that will live on the web as http://mt-domain.net/restricted. To do this, we will click on the
icon to navigate inside the public_html directory (which is the default root directory for cPanel websites).
- Click on the desired folder name. In this example this is called "restricted."
- Complete the form. Be sure to use a strong password. Then click the Save button.
- Great! You should now have a password protected directory, and a user who will have access to it.
Password Protect a Directory via SSH
This details how to use SSH to password protect web directories for your server. To proceed with these instructions, you will need SSH and FTP access to your server.
- Connect to the Grid via SSH. If you need help with this step, please refer to our article: Connecting via SSH to your server.
- Navigate to the html directory for the domain you'd like to protect. The command will look something like:
cd /home/00000/domains/example.com/html/
- Connect to your DV via SSH. If you need help with this step, please refer to our article: Connecting via SSH to your server.
- Navigate to the directory for the domain you'd like to protect. The command will look something like:
cd /var/www/vhosts/example.com
1. Use the htpasswd command to create a username and password that will be used to log into the directory you would like to protect. This username and password will be requested via a pop-up dialog box when users enter the protected directory. The command you'll need to use will look like this:
htpasswd -c .htpasswd janesmith
2. Follow the prompts and enter the password for this new user twice.
3. Create a .htaccess file with the following contents:
AuthGroupFile /dev/null
AuthName "Authentication Pop Up"
AuthType Basic
<LIMIT POST GET>
require valid-user janesmith
</LIMIT>
AuthName "Authentication Pop Up"
AuthType Basic
<LIMIT POST GET>
require valid-user janesmith
</LIMIT>
Comments