Selasa, Mei 19, 2009

.htaccess to protect mrtg with password

At the time of installation such as MRTG on the last post, only the entry on stage to create the look, how authentifikasi not have time to access and this will be prone to keep confidential : D . . then can use to . htaccess to give a password. But this is the step to do, but before apache condition must exist and running well :)

First off all we create a user using the passwd and htpasswd, now under the command like this:

$htpasswd -c /etc/apache2/apache-users admin
New password:
Re-type new password:

With the command that will be made with the user name admin and passwd now and there will be a file apache-users, the-c option above is included if you first create a user and passwd to .htaccess.

Then, create a file. Direktory htaccess in you will be protected, in this case is:

/var/www/mrtg/.htaccess

and the contents therein should kata2 this:

AuthName “Rahasia Sendiri”
AuthType Basic
AuthUserFile /etc/apache/apache-users
require valid-user

and make sure permission. htaccess can be accessed by the user will access the mrtg and order .htaccess authentication credentials to be allowed to mrtg, so I must have edited in:

vim /etc/apache/httpd.conf

with the change in part:

AllowOverride none

to be:

AllowOverride AuthConfig

and after disave do not forget to restart apache it. authconfig different settings for the apache and apache2. After that please try to access it with mrtg write: http://myserver/mrtg

0 komentar: