Skip to main content

I'm getting the following error client side when running a policy via the jamf binary:

Script Result: /private/tmp/SetARDAccess.sh: line 1: syntax error near unexpected token `newline'
/private/tmp/SetARDAccess.sh: line 1: `<?xml version="1.0" encoding="ISO-8859-1"?>'

The script runs fine locally on the clients, just not when passed via the jamf binary or run on a schedule.

Any idea why running the policy generates this xml error and how to resolve it? I don't see an errant newline anywhere. The script runs fine otherwise.

Server and clients are 7.1.

The policy changes a local admin (management account) password then runs a script (username removed for posting):

#!/bin/bash
# variables
user=<username here>
uid=/usr/bin/dscl . -read /users/$user UniqueID | awk '{print $2}'
ard_options="-activate -configure -clientopts -setreqperm -reqperm yes -setmenuextra -menuextra yes -configure -users $user -access -on -privs -all -restart -agent -menu"
#
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart $ard_options
# set sharing pref
/usr/bin/defaults write /Library/Preferences/com.apple.RemoteManagement ScreenSharingReqPermEnabled -bool true
# change the uid if it's below 500; if not, leave it alone, then hide the under 500 users
if [ $uid -gt 500 ]; then /usr/bin/dscl . -change /users/$user UniqueID $uid 499 /usr/sbin/chown -Rfv $user:staff /Users/<username here> /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool true /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array casper /usr/bin/touch /Library/Receipts/org.company.adminpasschange else if [ $uid -lt 500 ]; then echo "nothing to do. user already has a <500 uid." fi
fi

# check if a user is logged in, kill the loginwindow if there isn't, and do nothing if someone's logged in
currentuser=ls -l /dev/console | awk '{ print $3 }'
if [ "$currentuser" = "" ]; then echo "Restarting loginwindow..." /usr/bin/killall loginwindow
fi

exit 0

Nate,

By default shell and bourne again shell (bash) treat white space as new lines, so I am guessing you have a weird tab or space in the script that is throwing the whole thing out of whack. When I generally get these error messages I will copy/paste the script into a new plain text file and then go over each line looking for a weird spacing anywhere.

-Tom


Nate, Try forcing the clients to mount the caspershare over afp/smb instead of HTTP & let us know if that works.
It's an issue I've seen before & others have too. Me & the guys on the london CCA logged this with Miles as a bug.

Ben Toms
IT Support Analyst GREY Group
The Johnson Building, 77 Hatton Garden, London, EC1N 8JS
T: +44 (0) 20-3037-3819 |
Main: +44 (0) 20 3037 3000 | IT Helpdesk: +44 (0) 20 3037 3883


Also, I have the jamf binary create hidden user accounts for me post
image script, which seems to work rather well and lets me drop several
lines of unneeded code since it stream lines it.


Thanks, Tom and Ben. The account in this case already exists, so I'm hiding it separately.

There should also be no whitespace or anything in the original script, but I'll check again. Maybe I'll try it specifying /bin/sh instead of /bin/bash to see if it behaves any differently.

I thought it might have been an issue with the backticks in the subprocess, though it runs normally when invoked locally.


That was it… disabled http availability of the distribution point, and it worked fine.

Thanks, guys.