mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-24 15:02:44 +00:00
policycoreutils: setsebool should inform users they need to be root
Add a different error message when setsebool is unable to run because the user is not root. This just helps people who try to change booleans based on setroubleshoot output and don't know what went wrong. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
98dcd24976
commit
4c63498a4c
@ -82,8 +82,13 @@ static int selinux_set_boolean_list(size_t boolcnt,
|
||||
if (errno == ENOENT)
|
||||
fprintf(stderr, "Could not change active booleans: "
|
||||
"Invalid boolean\n");
|
||||
else if (errno)
|
||||
perror("Could not change active booleans");
|
||||
else if (errno) {
|
||||
if (getuid() == 0) {
|
||||
perror("Could not change active booleans");
|
||||
} else {
|
||||
perror("Could not change active booleans. Please try as root");
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -115,8 +120,13 @@ static int semanage_set_boolean_list(size_t boolcnt,
|
||||
goto err;
|
||||
|
||||
} else if (managed == 0) {
|
||||
fprintf(stderr,
|
||||
"Cannot set persistent booleans without managed policy.\n");
|
||||
if (getuid() == 0) {
|
||||
fprintf(stderr,
|
||||
"Cannot set persistent booleans without managed policy.\n");
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"Cannot set persistent booleans, please try as root.\n");
|
||||
}
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user