Changing Default Passwords in Nagios Network Analyzer


Changing Default Passwords in Nagios Network Analyzer

Prerequisites

You must have an existing Nagios Network Analyzer installation using default passwords. This document assumes you have not already changed any of the passwords.

Password Consideration

All of these password changes are completely optional, however it is typically a good idea to change default password settings for any software package. This will help secure your Nagios Network Analyzer software from security threats and network compromises.

For every example throughout this document you are setting the password to NewPassword which represents the password you will be changing the defaults to. When updating files on the Linux server or running commands replace NewPassword with the password of your choice.

MySQL vs MariaDB

MySQL is the database used by Nagios Network Analyzer in RHEL / CentOS 6.x, however in RHEL / CentOS 7.x onwards MariaDB is used instead of MySQL. MariaDB is simply a fork of the MySQL database, the commands issued in this documentation will work with either product. If there are any differences they will be clearly identified.

Editing Files

In many steps of this documentation you will be required to edit files. This documentation will use the vi text editor. When using the vi editor:

Changing the Linux Root System Account

Start by logging into the Linux server as the root user. Run the passwd command from the Linux command line with no arguments.

passwd

Changing password for user root.

New UNIX password: NewPassword

Retype new UNIX password: NewPassword

Nothing will be shown when you type the new password as Linux hides it for security reasons.

Changing MySQL Account Passwords

There are two important accounts for the MySQL database in a Nagios Network Analyzer installation: root and nagiosna. Each must be changed individually and in several places. This will by done from the Linux command line as the root user.

ROOT

First you will change the password for the root user in the MySQL database. To do so you will use the mysqladmin command and enter a new password, replace your new password in the command for NewPassword. Note the old password is welcome.

mysqladmin -u root password NewPassword

Next you will need to alter the files where the password for the root user is referenced. Locate the old password and replace it with your NewPassword.

/usr/local/nagiosna/scripts/restore_na.sh

Replace mysqlpass="nagiosna" with mysqlpass="NewPassword"

NAGIOSNA

Altering users passwords with MySQL requires a few different commands and different files will need to be modified. The following commands will be used to alter the fusion user account for the MySQL database.

After executing this command you will be prompted for the MySQL root password.

mysql -u root -p

You are now logged into the mysql command interface, this is indicated by the mysql> OR MariaDB [(none0]> prompt. Type each command as follows:

use mysql;
set password for 'nagiosna'@localhost= password('NewPassword');
flush privileges;
quit;

Next you need to alter the files where the password for the nagiosna user is referenced.

vi /var/www/html/nagiosna/application/config/config.local.php   
$config['db']['hostname'] = 'localhost';
$config['db']['username'] = 'nagiosna';
$config['db']['password'] = 'nagiosna';
$config['db']['database'] = 'nagiosna';

Replace $config['db']['password'] = 'nagiosna' with 'NewPassword'

Save the file, you have finished making changes.



Article ID: 913
Created On: Thu, Nov 11, 2021 at 11:11 AM
Last Updated On: Thu, Nov 11, 2021 at 11:11 AM
Authored by: rspielman

Online URL: https://support.nagios.com/kb/article/changing-default-passwords-in-nagios-network-analyzer-913.html