GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

HTTP Authentication

bullet Introduction
Your Virtual Private Servers Apache Web Server supports user authentication. In other words, it allows you to create password protected directories on your Virtual Private Servers web site. Let's say you want to restrict access to a the following directory to those with a valid username and password.
http://YOUR-DOMAIN.NAME/billy/

 

bullet Configuration
You can do this by connecting to your Virtual Private Servers via Telnet or SSH and following the steps below.
  1. Create a file named .htaccess in your ~/www/htdocs/billy directory that allows only allow one user (William) to access the directory. The .htaccess file must reside in the ~/www/htdocs/billy directory in order to control access to the ~/www/htdocs/billy directory.

    You can either create the .htaccess file while connected to your Virtual Private Servers (using a file editor like pico, for example) or you can create the file on your own PC and Upload it to your Virtual Private Servers. The file should contain the following text, depending on your Virtual Private Servers O/S.

    • FreeBSD & Solaris

      AuthUserFile /etc/.htpasswd
      AuthGroupFile /dev/null
      AuthName "Bill's Restaurant"
      AuthType Basic
      
      <Limit GET>
      require user William
      </Limit>
      
  2. Use the htpasswd command to set a password for the new user.

    Substitute your Virtual Private Servers login name for LOGIN-NAME below.

    % htpasswd -c /usr/home/LOGIN-NAME/etc/.htpasswd William
    

    You are free to use a different name or directory location for the password file. Just change the /usr/home/LOGIN-NAME/etc/.htpasswd above to whatever you want.

    The -c flag indicates that you are adding a user to the /etc/.htpasswd for the first time. When you add more users and passwords to the same password file, the -c flag is not necessary.

    % htpasswd /usr/home/LOGIN-NAME/etc/.htpasswd peanuts
    % htpasswd /usr/home/LOGIN-NAME/etc/.htpasswd almonds 
    % htpasswd /usr/home/LOGIN-NAME/etc/.htpasswd walnuts
    

 

bullet More Information
The best place to learn about user authentication is from the source (NCSA)

NOTE: You should be aware of one subtle difference with the Virtual Private Servers system. When you set up your .htaccess files, you specify the AuthUserFile or AuthGroupFile with respect to your home directory. However, when you set up your .htpasswd files with the htpasswd command you need to prepend /usr/home/LOGIN-NAME to the directory specification.


Toll Free 1-866-GSP-4400 • 1-301-464-9363 • service@gsp.com
Copyright © 1994-2016 GSP Services, Inc.