#!/bin/sh
. ./xi-sys.cfg
# Was previous step completed?
if [ ! -f installed.prereqs ]; then
echo "Prereqs were not installed - run previous script" >&2
exit 1
fi
# Was this step already completed?
if [ -f installed.usersgroups ]; then
echo "Users/groups already configured - skipping."
exit 0
fi
##########################################
# CREATE USERS AND GROUPS
##########################################
echo "Adding users and groups..."
eval "$useraddbin" -n "$nagiosuser"
eval "$groupaddbin" "$nagiosgroup"
eval "$groupaddbin" "$nagioscmdgroup"
eval "$usermodbin" -a -G "$nagioscmdgroup" "$nagiosuser"
eval "$usermodbin" -a -G "$nagioscmdgroup" "$apacheuser"
eval "$usermodbin" -a -G "$nagiosgroup" "$nagiosuser"
eval "$usermodbin" -a -G "$nagiosgroup" "$apacheuser"
# Make sure user exists
if ! grep -q "^$nagiosuser:" /etc/passwd; then
echo "ERROR: User '$nagiosuser' was not created - exiting." >&2
exit 1
fi
# Make sure groups exist
for group in "$nagiosgroup" "$nagioscmdgroup"; do
if ! grep -q "^$group:" /etc/group; then
echo "ERROR: Group '$group' was not created - exiting." >&2
exit 1
fi
done
echo "Users and groups added OK"
touch installed.usersgroups
The issue was with the mysql user, not the unix/application ids.
This was a query after the fullinstall. Maybe the issue is that I originally created databases called nagios and nagiosql on my production remote database and it looks like the installer creates the ndoutils database rather than the nagios database.
mysql -u root -p
'mypassword
'
> create database nagios;
> GRANT ALL ON nagios.* TO nagios@'<IP_OF_NAGIOS_SERVER>' IDENTIFIED BY 'nagios'
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
OK, that makes sense. I have been able to restore my prod backup to a new system twice without issue once I got the steps down pat.
Basically after running restore script, I edit the settings.php, config.inc.php and ndo2db.cfg changing dbserver to localhost, then create nagios@localhost user and grant all privileges, then set password for nagiosql@localhost.