0

so I'm trying to create an extra admin account on all Macs on the network. There are quite a few so I'm trying to do it through Apple Remote Desktop.

Do you guys know how to do this? This is all I have so far which is obviously missing some parts and giving the error: "no tty present and no askpass program specified." Any help is appreciated.

#!/bin/bash
# This script creates a user account under Mac OS X
sudo dscl . create /Users/SecurityTest33
sudo dscl . create /Users/SecurityTest33 UserShell /bin/bash
sudo dscl . create /Users/SecurityTest33 RealName "Security Test3"
sudo dscl . create /Users/SecurityTest33 UniqueID 503
sudo dscl . create /Users/SecurityTest33 PrimaryGroupID 1000
sudo dscl . create /Users/SecurityTest33 NFSHomeDirectory /Local/Users/SecurityTest33   
sudo dscl . passwd /Users/SecurityTest33 PASSWORD
sudo dscl . append /Groups/admin GroupMembership SecurityTest33
sudo cp -R /System/Library/User\ Template/English.lproj /Users/SecurityTest33
sudo chown -R SecurityTest33:staff /Users/SecurityTest33
echo "Created user" #$USERID: $USERNAME ($FULLNAME)
  • You can use the kickstart utility to configure all the features found in Apple Remote Desktop preferences. It is located at /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart – Ruskes Aug 13 '15 at 21:03
  • Let's close this for a brief hold. If you don't have a script that works locally, let's suss that out first. If you have one that works, adapting it for ARD might not be an issue or might require a different answerer than the one that can fix the script itself. – bmike Aug 13 '15 at 21:43
  • Hey @bmike kent was correct below with adding "root"...I need help getting the script to work correctly. Should I start a new thread for that? – youngandcrazy Aug 16 '15 at 1:27
  • Nah - Just up vote and accept the answer. I'll try to clean up the script formatting here for you. Feel free to edit the post or the answer as needed. – bmike Aug 16 '15 at 12:09
3

The error you're getting is related to the sudo command. You're probably trying to run the script as the normal administrator.

enter image description here

Instead, you can run it directly as root.

  • This might be the checkbox to push the script over the edge, let's get the OP to refine local execution of the script works first before we jump over hoops about ARD ... – bmike Aug 13 '15 at 21:43
  • @kent hey you were right once i ran as root the script ran successfully. I guess the question now is how I can run this script to work. First bmike, do i need a separate thread for the script? The script works and there is an account on the Mac but I cannot login with newly created user. Something up with the script? – youngandcrazy Aug 14 '15 at 22:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .