opret admin bruger på mac 10.9- 10.10 -Applescipt - shell
HejJeg har fundet et shell script, til at oprette bruger på en mac (Det virker fint) problemet er dog, at jeg skal ind og eksekvere det fra terminalen. Jeg kunne godt tænke mig, bare at kunne klikke på det, som et program.
Sådan her ser scriptet ud. opretadmin.sh"
"#!/bin/bash
# This script creates a user account under Mac OS X
# (tested with 10.5 and 10.6; likely works with 10.4 but not earlier)
# Written by Clinton Blackmore, based on work at
# http://serverfault.com/questions/20702
# === Typically, this is all you need to edit ===
USERNAME=Administrator
FULLNAME="Admin"
PASSWORD="123456"
# A list of (secondary) groups the user should belong to
# This makes the difference between admin and non-admin users.
# Leave only one uncommented
#SECONDARY_GROUPS="" # for a non-admin user
SECONDARY_GROUPS="admin _lpadmin _appserveradm _appserverusr" # for an admin user
# ====
if [[ $UID -ne 0 ]]; then echo "Please run $0 as root." && exit 1; fi
# Find out the next available user ID
MAXID=$(dscl . -list /Users UniqueID | awk '{print $2}' | sort -ug | tail -1)
USERID=$((MAXID+1))
# Create the user account
dscl . -create /Users/$USERNAME
dscl . -create /Users/$USERNAME UserShell /bin/bash
dscl . -create /Users/$USERNAME RealName "$FULLNAME"
dscl . -create /Users/$USERNAME UniqueID "$USERID"
dscl . -create /Users/$USERNAME PrimaryGroupID 20
dscl . -create /Users/$USERNAME NFSHomeDirectory /Users/$USERNAME
dscl . -passwd /Users/$USERNAME $PASSWORD
# Add use to any specified groups
for GROUP in $SECONDARY_GROUPS ; do
dseditgroup -o edit -t user -a $USERNAME $GROUP
done
# Create the home directory
createhomedir -c > /dev/null
echo "Created user #$USERID: $USERNAME ($FULLNAME)"
"
Jeg har prøvet at køre det fra applescript sådan her "
do shell script "Opret_administratorbruger.sh" with administrator privileges
"
Men så får jeg denne fejl "/bin/sh: Opret_administratorbruger.sh: command not found"
Nogen der har nogle forslag til at kunne løse det?