Follow

Password protecting directories

Applies to: Grid
  • Difficulty: Easy
  • Time Needed: 20
  • Tools Required: AccountCenter access or SSH, FTP client
Applies to: Wordpress
  • Difficulty: Easy
  • Time Needed: 5
  • Tools Required: AccountCenter access or WP Admin access
Applies to: All DV
  • Difficulty: Easy
  • Time Needed: 10
  • Tools Required: Plesk administrator access or SSH, FTP client

Overview

You can restrict access to a web folder on your server.

Requirements

 The only requirement is access to your WordPress dashboard.
 
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.

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

 

 

The WordPress dashboard makes it very easy to restrict access to particular pages.

1. Start by logging into the WordPress dashboard. You can do this via the Media Temple account center by selecting WP ADMIN, or by navigating to yourdomain.com/wp-admin. After logging in, select Pages from the menu on the left. 

 

 

2. hover over the page that you would like to protect and select Quick Edit

 

 

 

 

3. 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 Directory via the AccountCenter

Create your Web Users

  1. Log into your AccountCenter.
  2. Click on the blue Admin button associated to your Grid server.

    g1.png

  3. Click on Password Protect Folders.

    g2.png

  4. Click on the ADD A NEW WEB USER button.

    g2.5.png

  5. 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.

    g4.png

  6. Click SAVE. Then continue onto create a Web User Group and Protected Folders.

Optional: Create a Web User Groups

  1. Click on ADD A NEW WEB GROUP.

    g5.png

  2. Create a Group Name for your records. Add users to your new group using the drop down menu.

    g6.png

  3. Click Save. Then continue on to create Protected Folders.

Create your Protected Folders

  1. Click on PROTECT A NEW FOLDER.

    g3.png

  2. 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.

    g7.png 

  3. Add a Description for your records. Then select your desired Group and/or User access through the drop down menus.

    g8.png

  4. Click SAVE.
  5. Great! You should now have a password protected directory, and a user who will have access to it.

Plesk

  1. Log into the Plesk Control Panel for your domain.
  2. Select Password-Protected Directories.

    p1.png

  3. Click on the Add Protected Directory icon.

    p2.png

  4. Complete the form. In our example, we create a protected directory called specialdata, entitled PasswordProtect.

    p3.png

    • 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.
  5. You will be returned to the previous page with a confirmation message.
  6. We will now create users who will have access to the directory. Click on the directory you just created.

    p4.png

  7. Click on the Add a User icon.

    p5.png

  8. Complete the form. Be sure to use a strong password. Click the OK button to save your user.

    p6.png

  9. 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.

  1. Log into the cPanel account for your domain.
  2. Scroll down to Files. Click on Directory Privacy.

    cp1.png

  3. 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 cp2.25.png  icon to navigate inside the public_html directory (which is the default root directory for cPanel websites).

    cp2.png
  4. Click on the desired folder name. In this example this is called "restricted."

    cp2.5.png

  5. Complete the form. Be sure to use a strong password. Then click the Save button.

    cp3.png

  6. 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:

AuthUserFile /home/00000/domains/example.com/html/.htpasswd
AuthGroupFile /dev/null
AuthName "Authentication Pop Up"
AuthType Basic
<LIMIT POST GET>
require valid-user janesmith
</LIMIT> 

AuthUserFile /var/www/vhosts/example.com/.htpasswd AuthGroupFile /dev/null
AuthName "Authentication Pop Up"
AuthType Basic
<LIMIT POST GET>
require valid-user janesmith
</LIMIT> 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk