From 6bfe6f31dba1d2fa648eebf9c1218c5bd01744ad Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Fri, 17 Oct 2014 14:06:28 +0200 Subject: common-functions.sh: prevent running as root --- bin/common-functions.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bin') diff --git a/bin/common-functions.sh b/bin/common-functions.sh index 45c16f0c..583d5b5c 100755 --- a/bin/common-functions.sh +++ b/bin/common-functions.sh @@ -11,6 +11,11 @@ common_cleanup(){ common_init() { # check whether this script has been started from /tmp already if [ "${0:0:5}" != "/tmp/" ] ; then + # check that we are not root + if [ $(id -u) -eq 0 ] ; then + echo "Do not run this as root." + exit 1 + fi # mktemp some place for us... TTT=$(mktemp --tmpdir=/tmp jenkins-script-XXXXXXXX) # prepare cleanup -- cgit v1.2.3-70-g09d2