<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Apache_Basic_Auth_and_Controlling_Access</id>
	<title>Apache Basic Auth and Controlling Access - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Apache_Basic_Auth_and_Controlling_Access"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Apache_Basic_Auth_and_Controlling_Access&amp;action=history"/>
	<updated>2026-05-13T09:28:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=Apache_Basic_Auth_and_Controlling_Access&amp;diff=23958&amp;oldid=prev</id>
		<title>Cesar Chew at 17:47, 24 November 2014</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Apache_Basic_Auth_and_Controlling_Access&amp;diff=23958&amp;oldid=prev"/>
		<updated>2014-11-24T17:47:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Cat|Apache|03}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;slideshow style=&amp;quot;nobleprog&amp;quot; headingmark=&amp;quot;⌘&amp;quot; incmark=&amp;quot;…&amp;quot; scaled=&amp;quot;true&amp;quot; font=&amp;quot;Trebuchet MS&amp;quot; &amp;gt;&lt;br /&gt;
;title: Apache Basic Auth and Controlling Access&lt;br /&gt;
;author: Sam Bashton (NobleProg Ltd)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/slideshow&amp;gt;&lt;br /&gt;
=== Basic Auth ⌘===&lt;br /&gt;
* Basic authentication is built into HTTP&lt;br /&gt;
* Sends a hash of username:password in the HTTP header&lt;br /&gt;
* Also works over HTTPS&lt;br /&gt;
* It requires no modification of any code&lt;br /&gt;
* User interaction handled by the browser&lt;br /&gt;
=== Configuring HTTP auth in Apache ⌘===&lt;br /&gt;
* First, we need to create a password file and add a user&lt;br /&gt;
 ```&lt;br /&gt;
 $ htpasswd -mc /etc/httpd/htpasswd example&lt;br /&gt;
 ```&lt;br /&gt;
* This creates the file /etc/httpd/htpasswd file, with the user &amp;#039;example&amp;#039;&lt;br /&gt;
* Do this **only when creating a new password file**&lt;br /&gt;
* To add more users (in this case **example2**: &lt;br /&gt;
 ```&lt;br /&gt;
 htpasswd -m /etc/httpd/htpasswd example2&lt;br /&gt;
 ```&lt;br /&gt;
=== Requiring authentication ⌘===&lt;br /&gt;
* In the vhost config, add a Location section&lt;br /&gt;
 ```&lt;br /&gt;
 &amp;lt;Location /&amp;gt;&lt;br /&gt;
    AuthType Basic&lt;br /&gt;
    AuthName &amp;quot;Authentication&amp;quot;&lt;br /&gt;
    AuthUserFile /etc/httpd/htpasswd&lt;br /&gt;
    Require valid-user&lt;br /&gt;
  &amp;lt;/Location&amp;gt;&lt;br /&gt;
 ```&lt;br /&gt;
=== Limiting access by IP ⌘===&lt;br /&gt;
* You can also limit by IP address&lt;br /&gt;
 ```&lt;br /&gt;
  &amp;lt;Location /&amp;gt;&lt;br /&gt;
    Order allow,deny&lt;br /&gt;
    Allow from 192.168.1.1&lt;br /&gt;
    Deny from all&lt;br /&gt;
  &amp;lt;/Location&amp;gt;&lt;br /&gt;
 ```&lt;br /&gt;
=== Requiring a password only to some IPs ⌘===&lt;br /&gt;
* All everyone from a certain set of IPs access without a username/password&lt;br /&gt;
* Require that anyone accessing from outside must supply username/password&lt;br /&gt;
 ```&lt;br /&gt;
  &amp;lt;Location /&amp;gt;&lt;br /&gt;
    AuthType Basic&lt;br /&gt;
    AuthName &amp;quot;Authentication&amp;quot;&lt;br /&gt;
    AuthUserFile /etc/httpd/htpasswd&lt;br /&gt;
    Require valid-user&lt;br /&gt;
    Allow from 192.168.1.1&lt;br /&gt;
    Deny from all&lt;br /&gt;
    Satisfy any&lt;br /&gt;
  &amp;lt;/Location&amp;gt;&lt;br /&gt;
 ```&lt;br /&gt;
=== Exercise ⌘===&lt;br /&gt;
* Make the virtualhost specified in /etc/httpd/conf.d/example.conf require a username + password&lt;/div&gt;</summary>
		<author><name>Cesar Chew</name></author>
	</entry>
</feed>