07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

• MultiViews enables content negotiation; this can be used by the server to return a web<br />

page matching the preferred language as configured in the browser.<br />

BACK TO BASICS<br />

.htaccess file<br />

The .htaccess file contains Apache configuration directives enforced each<br />

time a request concerns an element of the directory where it is stored. The<br />

scope of these directives also recurses to all the subdirectories within.<br />

Most of the directives that can occur in a Directory block are also legal in a<br />

.htaccess file.<br />

The AllowOverride directive lists all the options that can be enabled or disabled by way of a<br />

.htaccess file. A common use of this option is to restrict ExecCGI, so that the administrator<br />

chooses which users are allowed to run programs under the web server's identity (the wwwdata<br />

user).<br />

11.2.3.1. Requiring Authentication<br />

In some circumstances, access to part of a website needs to be restricted, so only legitimate<br />

users who provide a username and a password are granted access to the contents.<br />

Require valid-user<br />

AuthName "Private directory"<br />

AuthType Basic<br />

AuthUserFile /etc/apache2/authfiles/htpasswd-private<br />

Example 11.19<br />

.htaccess file requiring authentication<br />

SECURITY<br />

No security<br />

The authentication system used in the above example (Basic) has minimal<br />

security as the password is sent in clear text (it is only encoded as base64,<br />

which is a simple encoding rather than an encryption method). It should also<br />

be noted that the documents “protected” by this mechanism also go over the<br />

network in the clear. If security is important, the whole HTTP connection<br />

should be encrypted with SSL.<br />

The /etc/apache2/authfiles/htpasswd-private file contains a list of users and passwords;<br />

it is commonly manipulated with the htpasswd command. For example, the following command<br />

is used to add a user or change their password:<br />

# htpasswd /etc/apache2/authfiles/htpasswd-private user<br />

New password:<br />

Re-type new password:<br />

Adding password for user user<br />

272 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!