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
- Setup credentials for very first user
- Add new user to existing file (note: do not use -c option, if already exists, it is rewritten and truncated)
- Update password for existing user
- Remove user from the file
In next article, we will cover how to configure these credentials in Apache.