From c32b90dec78afe0db51ff0afa6448c01524105fa Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 3 May 2012 16:17:58 +0200 Subject: [PATCH] systemctl: print a nice error message if an unprivileged user calls systemctl reboot -ff --- src/systemctl/systemctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index e2550adb..cbe6848d 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 || -- 2.39.5