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)
|
||||
{
|
||||
$content = (array)$content;
|
||||
|
|
Loading…
Reference in New Issue