From b0526459da47522b5548716ff61abe74bca73e01 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Mon, 28 Sep 2009 12:17:14 +0200 Subject: [PATCH] Make sure that the script is running with root privileges --- useradd.macosx.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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- -- 2.39.2