Skip to main content

Posts

Showing posts with the label linux

Securing Websited Hosted with Apache Web Server

In my previous article about Creating or Updating Users in htpasswd File, we saw how to create, update and remove user from htpasswd file. In this article, we will see how we can configure this file in Apache web server so that users will be prompts to provide credentials for accessing the web sites hosted with Apache web server. Follow my previous article and setup the users. Next, go to httpd and open the file which has virtual host configurations for your web site. Update the virtual host entry, it should looks something like this: Note that AuthType , AuthName , AuthUserFile and Require are important. Make sure to remove " Require all granted " from the virtual host entry (if you have it already). Otherwise, your website will be accessible without any authentication. That's it. Restart you Apache Web Server and now you will be prompted to provide credentials when you try to access the web site. P.S. Click here to access my other posts.

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 comand 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. P.S. Click...