I can't log in to Nagios web interface

21,692

Solution 1

<Directory "/usr/lib/nagios/cgi-bin/">
   Options ExecCGI
   AllowOverride None
   Order allow,deny
   Allow from all
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /etc/nagios/passwd
   Require valid-user
</Directory>

You have specified the wrong path for AuthUserFile: it should be /etc/nagios/htpasswd.users instead of /etc/nagios/htpasswd.

Solution 2

Ensure that apache's user can read /etc/nagios/htpasswd.users:

If your apache user is www-data, then:

$ sudo chown www-data /etc/nagios/htpasswd.users
$ sudo chmod 600 /etc/nagios/htpasswd.users
Share:
21,692

Related videos on Youtube

Quanticat
Author by

Quanticat

Are you funky enough ?

Updated on September 18, 2022

Comments

  • Quanticat
    Quanticat almost 2 years

    When i try to login to Nagios in my web browser and after having repeatedly enter my login and password on my Nagios page http://127.0.0.1/nagios/, i get this :

    Authorization Required

    This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required. Apache/2.2.15 (Red Hat) Server at 127.0.0.1 Port 80

    I changed the password :

    htpasswd -c /etc/nagios/htpasswd.users nagiosadmin
    

    And restart the server :

    service httpd restart
    

    But without result !

    • Greg Petersen
      Greg Petersen almost 12 years
      What does the Apache error log say? Show us your configuration for Nagios /etc/httpd/conf.d/nagios.conf?
    • Quanticat
      Quanticat almost 12 years
      This is the configuration for Nagios : pastebin.com/eNek5CPD
    • Quanticat
      Quanticat almost 12 years
      And this is the Apache's error.log : pastebin.com/94iWakSu
    • Greg Petersen
      Greg Petersen almost 12 years
      user nagiosadmin: authentication failure for "/nagios/": Password Mismatch.
    • ILMostro_7
      ILMostro_7 over 7 years
      RHEL/CentOS provides /etc/nagios/passwd by default. Execute htpasswd -c /etc/nagios/passwd nagiosadmin, followed by your desired password, and all's fine in the world. :D
  • ILMostro_7
    ILMostro_7 over 7 years
    Oddly enough, the file supplied by the nagios package on CentOS7, for example, already has an entry for nagiosadmin:RaNdOmHash. However, that doesn't take effect until one executes htpasswd -c /etc/nagios/passwd. As long as the AuthUserFile is specified to htpasswd, it shouldn't matter what it's called.
  • ILMostro_7
    ILMostro_7 over 7 years
    As long as the Group, e.g. www-data, can read the file, it can have 640 permissions, owned by root:www-data.
  • ILMostro_7
    ILMostro_7 over 7 years
    Duh, it makes sense that it doesn't work by default, as the password entry is hashed/scrambled.