Check running user lnms (#11726)
This commit is contained in:
parent
90e95f160d
commit
6a4f2025c3
|
@ -116,6 +116,20 @@ class Checks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check the script is running as the right user (works before config is available)
|
||||||
|
*/
|
||||||
|
public static function runningUser()
|
||||||
|
{
|
||||||
|
if (function_exists('posix_getpwuid') && posix_getpwuid(posix_geteuid())['name'] !== get_current_user()) {
|
||||||
|
self::printMessage(
|
||||||
|
'Error: You must run lnms as the user ' . get_current_user(),
|
||||||
|
null,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static function printMessage($title, $content, $exit = false)
|
private static function printMessage($title, $content, $exit = false)
|
||||||
{
|
{
|
||||||
$content = (array)$content;
|
$content = (array)$content;
|
||||||
|
|
3
lnms
3
lnms
|
@ -15,6 +15,9 @@
|
||||||
|
|
||||||
require __DIR__.'/bootstrap/autoload.php';
|
require __DIR__.'/bootstrap/autoload.php';
|
||||||
|
|
||||||
|
// Check that we don't run this as the wrong user and break the install
|
||||||
|
\App\Checks::runningUser();
|
||||||
|
|
||||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue