Technical Recipes
Monday 19, December 2011
Sometimes it's very useful to protect a web directory with user/password. Apache web server offers us a simple method to do that based on HTTP basic authentication. We need to create a specific file called .htpasswd, then our conf. file should be changed for adding the protection. Let's do it:
$ htpasswd -c .htpasswd myuser
The previous command will create a new file called .htpasswd. This file should be located inside the directory which will be protected. Then we need to change our Apache's conf. file adding these lines:
<Location /mydirectory> AuthUserFile /home/myuser/mydirectory/.htpasswd AuthName "Protected area" AuthType Basic require valid-user </Location>
When a user access to protected directory Apache will display a dialog box asking for user/passwd.
Pages:
Tags
My latest tweets
@greggpollack Looking forward for it!!
@gaalal Puerta del Sol, 19:30h #PrimaveraValenciana #yotambiensoyelenemigo
Hoy más que nunca: Vergüenza me daría ser policía #PrimaveraValenciana
Cuando el "enemigo" son los estudiantes y los periodístas, algo muy grave está pasando #PrimaveraValenciana




