Creating or Updating Users in htpasswd File

The Apache  HTTP Server is free and open-source cross-platform web server. It can be configured to protect either entire website or part of the website. Once the authentication is enabled, user will be prompted to enter credentials to access the web pages.

It is two step process, first, we need to setup the user credentials, and second, we need to configure these credentials in Apache. In this article, we will be covering the first part i.e. setting the user credentials.

We will be using htpasswd command line tool to create and manage users. I would suggest to login a root user. Let’s say, we will be storing user credentials in this file: /etc/.apache_users

  1. Setup credentials for very first user
  2. Add new user to existing file (note: do not use -c option, if already exists, it is rewritten and truncated)
  3. Update password for existing user
  4. Remove user from the file

In next article, we will cover how to configure these credentials in Apache.

Leave a Reply

Your email address will not be published. Required fields are marked *