<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Naeh.net &#187; vhost</title>
	<atom:link href="http://naeh.net/tag/vhost/feed/" rel="self" type="application/rss+xml" />
	<link>http://naeh.net</link>
	<description>Le mémo du développeur</description>
	<lastBuildDate>Thu, 09 Sep 2010 15:30:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Protéger un répertoire par htaccess</title>
		<link>http://naeh.net/proteger-un-repertoire-par-un-htaccess/</link>
		<comments>http://naeh.net/proteger-un-repertoire-par-un-htaccess/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 23:18:34 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Serveur]]></category>
		<category><![CDATA[vhost]]></category>

		<guid isPermaLink="false">http://naeh.net/proteger-un-repertoire-par-un-htaccess/</guid>
		<description><![CDATA[Le but de cet article est montrer comment protéger un répertoire par un htaccess.
pour cela il faut d'abord créer un fichier .htaccess à la racine du répertoire, ce fichier doit contenir  les lignes suivantes (a adapter selon la configuration/ besoins) :

AuthName &#34;Page protégée&#34;
AuthType Basic
AuthUserFile &#34;/CHEMIN/VERS/LE/FICHIER/.htpasswd&#34;
Require valid-user

en suite il faut créer un fichier .htpasswd qui [...]]]></description>
			<content:encoded><![CDATA[<p>Le but de cet article est montrer comment protéger un répertoire par un <strong>htaccess</strong>.</p>
<p>pour cela il faut d'abord créer un fichier <em>.htaccess</em> à la racine du répertoire, ce fichier doit contenir  les lignes suivantes (a adapter selon la configuration/ besoins) :</p>

<div class="wp_codebox"><table><tr id="p484"><td class="code" id="p48code4"><pre class="bash" style="font-family:monospace;">AuthName <span style="color: #ff0000;">&quot;Page protégée&quot;</span>
AuthType Basic
AuthUserFile <span style="color: #ff0000;">&quot;/CHEMIN/VERS/LE/FICHIER/.htpasswd&quot;</span>
Require valid-user</pre></td></tr></table></div>

<p>en suite il faut créer un fichier <em>.htpasswd</em> qui lui contiendra les couples login/mot de passe qui auront accès au répertoire protégé.<br />
pour cela exécutez la commande suivante :</p>

<div class="wp_codebox"><table><tr id="p485"><td class="code" id="p48code5"><pre class="bash" style="font-family:monospace;">htpasswd <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>CHEMIN<span style="color: #000000; font-weight: bold;">/</span>VERS<span style="color: #000000; font-weight: bold;">/</span>LE<span style="color: #000000; font-weight: bold;">/</span>FICHIER<span style="color: #000000; font-weight: bold;">/</span>.htpasswd LOGIN</pre></td></tr></table></div>

<p>-c pour créer un nouveau fichier <em>.htpasswd</em> (a ne pas utiliser si vous ajouter un utilisateur à un fichier existant).<br />
il vous sera ensuite demandé d'entrer le mot de passe 2 fois, faites le, et le tour est joué.</p>
<p>pour plus de renseignement sur la commande <strong>htpasswd</strong>, voici l'écran d'aide de ladite commande :</p>

<div class="wp_codebox"><table><tr id="p486"><td class="code" id="p48code6"><pre class="bash" style="font-family:monospace;">$ htpasswd
Usage:
        htpasswd <span style="color: #7a0874; font-weight: bold;">&#91;</span>-cmdpsD<span style="color: #7a0874; font-weight: bold;">&#93;</span> passwordfile username
        htpasswd -b<span style="color: #7a0874; font-weight: bold;">&#91;</span>cmdpsD<span style="color: #7a0874; font-weight: bold;">&#93;</span> passwordfile username password
        htpasswd -n<span style="color: #7a0874; font-weight: bold;">&#91;</span>mdps<span style="color: #7a0874; font-weight: bold;">&#93;</span> username
        htpasswd -nb<span style="color: #7a0874; font-weight: bold;">&#91;</span>mdps<span style="color: #7a0874; font-weight: bold;">&#93;</span> username password
&nbsp;
 <span style="color: #660033;">-c</span>  Create a new file.
 <span style="color: #660033;">-n</span>  Don<span style="color: #ff0000;">'t update file; display results on stdout.
 -m  Force MD5 encryption of the password.
 -d  Force CRYPT encryption of the password (default).
 -p  Do not encrypt the password (plaintext).
 -s  Force SHA encryption of the password.
 -b  Use the password from the command line rather than prompting for it.
 -D  Delete the specified user.
On Windows, NetWare and TPF systems the '</span><span style="color: #660033;">-m</span><span style="color: #ff0000;">' flag is used by default.
On all other systems, the '</span><span style="color: #660033;">-p</span><span style="color: #ff0000;">' flag will probably not work.</span></pre></td></tr></table></div>

<p>notez aussi que pour que cette protection fonctionne, il est obligatoire de ne pas avoir la directive apache <strong>AllowOverride</strong> a none, sinon le fichier <em>.htaccess</em> ne sera pas pris en compte, donc n'oubliez pas de la commenter ou l'enlever tout simplement si vous l'avez dans votre <strong>vhost</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/proteger-un-repertoire-par-un-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
