From: Lennart Poettering Date: Thu, 3 May 2012 14:17:58 +0000 (+0200) Subject: systemctl: print a nice error message if an unprivileged user calls systemctl reboot -ff X-Git-Tag: v183~168 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=c32b90dec78afe0db51ff0afa6448c01524105fa systemctl: print a nice error message if an unprivileged user calls systemctl reboot -ff --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index e2550adb5..cbe6848d0 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 ||