diff --git a/config.php.default b/config.php.default index 1ed5d8c7e..919150357 100755 --- a/config.php.default +++ b/config.php.default @@ -14,6 +14,10 @@ $config['memcached']['enable'] = FALSE; $config['memcached']['host'] = "localhost"; $config['memcached']['port'] = 11211; +// This is the user LibreNMS will run as +//Please ensure this user is created and has the correct permissions to your install +$config['user'] = 'librenms'; + ### Locations - it is recommended to keep the default #$config['install_dir'] = "/opt/librenms"; diff --git a/html/install.php b/html/install.php index 232a44c12..2e98f1b32 100644 --- a/html/install.php +++ b/html/install.php @@ -375,6 +375,10 @@ $config_file = <<<"EOD" \$config\['db_name'\] = "$dbname"; \$config\['db'\]\['extension'\] = "mysqli";// mysql or mysqli +// This is the user LibreNMS will run as +//Please ensure this user is created and has the correct permissions to your install +\$config['user'] = 'librenms'; + ### Memcached config - We use this to store realtime usage \$config\['memcached'\]\['enable'\] = FALSE; \$config\['memcached'\]\['host'\] = "localhost"; diff --git a/validate.php b/validate.php index 0088e9411..dbfc89c4a 100755 --- a/validate.php +++ b/validate.php @@ -59,6 +59,25 @@ require_once 'includes/definitions.inc.php'; require_once 'includes/functions.php'; require_once $config['install_dir'].'/includes/alerts.inc.php'; +// Let's test the user configured if we have it +if (isset($config['user'])) { + $tmp_user = $config['user']; + $tmp_dir = $config['install_dir']; + $tmp_log = $config['log_dir']; + $find_result = rtrim(`find $tmp_dir \! -user $tmp_user -not -path $tmp_log`); + if (!empty($find_result)) { + // This isn't just the log directory, let's print the list to the user + $files = explode(PHP_EOL, $find_result); + if (is_array($files)) { + print_fail("We have found some files that are owned by a different user than $tmp_user, this will stop you updating automatically and / or rrd files being updated causing graphs to fail:\n"); + foreach ($files as $file) { + echo "$file\n"; + } + echo "\n"; + } + } +} + // Run test on MySQL $test_db = @mysqli_connect($config['db_host'], $config['db_user'], $config['db_pass'], $config['db_name']); if (mysqli_connect_error()) {