This implements FS#24095. The check is only made for the start, stop and restart actions of the daemon scripts. This allows regular user to use the help and list functionality of rc.d and also to use rc.d for actions that doesn't require root privileges, like the status action of some daemon scripts. Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com> --- rc.d | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/rc.d b/rc.d index 97f266a..2325623 100755 --- a/rc.d +++ b/rc.d @@ -43,6 +43,10 @@ case $1 in ;; *) action=$1 + if [[ "$EUID" != '0' ]] && [[ "$action" == 'start' || "$action" == 'stop' || "$action" == 'restart' ]] ; then + echo 'Error: this script must be run as root to use this functionality.' + exit 1 + fi shift # set same environment variables as init runlevel=$(/sbin/runlevel) -- 1.7.5.2