Buscar este blog

miércoles, 2 de noviembre de 2011

Htaccess Authentication.

Configuration: Protecting content with basic authentication Linux Http Apache.



There are two configuration steps which you must complete in order to protect a resource using basic authentication. Or three, depending on what you are trying to do.
  1. Create a password file
  2. Set the configuration to use this password file
Create folder o select folder store password. Create a password file.

Create Folder
mkdir /pwd_http

htpasswd -c /pwd_http/password.file username

Example:
# htpasswd -c /pwd_http/password.file user1
New password: password_use1
Re-type new password: password_user1
Adding password for user user1


Edit or create the file. Htaccess the website of the folder where files are located.


# vi .htaccess
AuthType Basic
AuthName "Password Required"
AuthUserFile /
password_http/password.file
Require valid-user

Restart service https
# /etc/init.d/httpd restart

Test Login Website.

More info:# man htpasswd

No hay comentarios:

Publicar un comentario