From: Alexander Barton Date: Mon, 28 Sep 2009 10:17:14 +0000 (+0200) Subject: Make sure that the script is running with root privileges X-Git-Url: https://arthur.barton.de/gitweb/?p=usertools.macosx.git;a=commitdiff_plain;h=b0526459da47522b5548716ff61abe74bca73e01;hp=eb5ed4011fa56c1a0f826f6747e371d30a0d6309 Make sure that the script is running with root privileges --- diff --git a/useradd.macosx.sh b/useradd.macosx.sh index 0bebb0c..5382ec0 100755 --- a/useradd.macosx.sh +++ b/useradd.macosx.sh @@ -111,6 +111,8 @@ done [ -n "$home_dir" ] || home_dir="/Users/$user_name" [ -n "$shell" ] || shell="/bin/bash" +[ "$UID" -eq 0 ] || Abort "This script must be run as root!" + # Check that directory services are running launchctl list 2>/dev/null | fgrep "com.apple.DirectoryServices" >/dev/null 2>&1 if [ $? -ne 0 ]; then @@ -184,4 +186,4 @@ chmod 755 "$home_dir" || Abort echo "User '$user_name' ($user_id) has been created." exit 0 -# -eof- \ No newline at end of file +# -eof-