mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-22 03:32:04 +00:00
block the command if run by non-root users (#5438)
This commit is contained in:
parent
9e161adf7c
commit
ce42f6e03e
@ -67,6 +67,13 @@ if ($::HELP)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
my $current_usr = getpwuid($>);
|
||||
if ($current_usr ne "root")
|
||||
{
|
||||
print "Can't run this command for non-root user\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
my $switchestab;
|
||||
my $switchhash;
|
||||
my $passwdtab;
|
||||
|
@ -62,6 +62,13 @@ if ($::HELP)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
my $current_usr = getpwuid($>);
|
||||
if ($current_usr ne "root")
|
||||
{
|
||||
print "Can't run this command for non-root user\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ($::SWITCH)
|
||||
{
|
||||
my @filternodes = xCAT::NodeRange::noderange( $::SWITCH );
|
||||
|
@ -61,6 +61,13 @@ if ($::HELP)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
my $current_usr = getpwuid($>);
|
||||
if ($current_usr ne "root")
|
||||
{
|
||||
print "Can't run this command for non-root user\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ($::SWITCH) {
|
||||
my @filternodes = xCAT::NodeRange::noderange( $::SWITCH );
|
||||
if (nodesmissed) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user