Protect MRTG graphs

Home » Tutorials » MRTG Howto

/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/mrtg_config_step_9.php Debug

Step # 9 Optional: Protect your MRTG graphs/html pages with password protected directory

Once again, you would like to restrict access to your MRTG reports. This can easily accomplished with Apache webserver's .htaccess file. If you are on webhosting server with control panel (such as ensim or plesk) then you can use control panel itself to create password-protected directory.

Steps to protect graphs using apache's .htaccess file and htpasswd command:

Step # 1: Create .htaccess file in /var/www/html/mymrtg/ directory and append the following directives:

vi /var/www/html/mymrtg/.htaccess

Add following text to file:

AuthName "MRTG Graphs/Html restricted access"
AuthType Basic
AuthUserFile /var/members/.htpasswd
require user mrtgadmin

Step # 2: Create a user account and password. The -c option assumes that you are creating .htpasswd file first time:

# htpasswd -c /var/members/.htpasswd mrtgadmin

For more information please see our Apache Webserver Authentication and access control mini-howto.

/nixcraft/linux/docs/uniqlinuxfeatures/mrtg/mrtg_config_step_9.php Debug