<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>Howto/Webpage/PasswordProtection</title><revhistory><revision><revnumber>4</revnumber><date>2009-01-14 20:34:54</date><authorinitials>independence</authorinitials></revision><revision><revnumber>3</revnumber><date>2009-01-14 20:32:35</date><authorinitials>independence</authorinitials><revremark>xapian pragma keyword bug?</revremark></revision><revision><revnumber>2</revnumber><date>2009-01-14 20:29:07</date><authorinitials>independence</authorinitials><revremark>keywords</revremark></revision><revision><revnumber>1</revnumber><date>2009-01-14 20:10:10</date><authorinitials>independence</authorinitials><revremark>password protected dir in public_html</revremark></revision></revhistory></articleinfo><section><title>Howto: Password Protection</title><para>This howto will briefly explain how to set up a directory on your webpage that requires username/password authentication for access. </para><para>First, create a new directory in your public_html where you will put the files which you want to protect: </para><screen><![CDATA[cd ~/public_html
mkdir secret]]></screen><para>Create a file named <code>.htaccess</code> in the new directory with the following content (edit with: <code>nano -w secret/.htaccess</code> for example): </para><screen><![CDATA[AuthUserFile /var/www/users/myusername/secret/.htpasswd
AuthName "Secret directory"
AuthType Basic
Require valid-user]]></screen><para>Remember to replace <code>myusername</code> in the pathname with your username. </para><para>The last step is to create the file that will store your usernames and passwords: </para><screen><![CDATA[/usr/sbin/htpasswd -c secret/.htpasswd username]]></screen><para>The last parameter here (<code>username</code>) is the name of the user for which you want to create a new password. If you want to add more users remove <code>-c</code> (create new) from the argument list and issue the command again. </para><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="http://ipv6.blinkenshell.org/wiki/Howto/Webpage/PasswordProtection/wiki/CategoryHowto#">CategoryHowto</ulink> </para></section></article>