Table of Contents

Add HTTP Password Login to a Site

For adding the very first user

  1. Find out the AuthUserFile path in the Apache config file. For Ubuntu, it is located in /etc/apache/conf-enabled/YOUR_SITE_PROFILE.conf. For this example, the path is /etc/apache2/.htpasswd
  2. For create the FIRST account for user with login user1
    sudo htpasswd -c /etc/apache2/.htpasswd user1
  3. Type in the new password for user1
  4. Type the password again
  5. The password is added.

For adding additional user

  1. Type
    sudo htpasswd /etc/apache2/.htpasswd anotheruser

    Note that we do not have -c in the command.

  2. Type in the new password for anotheruser
  3. Type the password again
  4. The password is added.