summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-03 16:17:58 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-03 16:17:58 +0200
commitc32b90dec78afe0db51ff0afa6448c01524105fa (patch)
treea8b8ccb9dc2e9497175bdc9650665a9c8304f982 /src/systemctl
parent65491fd8c993a0e5cbc275613babcac98f4cd7bd (diff)
systemctl: print a nice error message if an unprivileged user calls systemctl reboot -ff
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index e2550adb58..cbe6848d03 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1788,6 +1788,11 @@ static int start_special(DBusConnection *bus, char **args) {
a = verb_to_action(args[0]);
+ if (arg_force >= 2 && geteuid() != 0) {
+ log_error("Must be root.");
+ return -EPERM;
+ }
+
if (arg_force >= 2 &&
(a == ACTION_HALT ||
a == ACTION_POWEROFF ||