Installing user level profile with PKG (No APNs enabled in our environment)

rqomsiya
Contributor III

Hi all,

I'm trying to deploy user level configuraiton profiles, but the below script doesn't seem to be working.. any ideas?

#!/bin/bash

logged_in_user=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");'`

echo $logged_in_user

/usr/bin/profiles -I -U $logged_in_user -F /tmp/ml0154927_ILA.mobileconfig

exit 0

If i manually double click and install the profile when the user is logged in, it works fine, however it prompts for admin creds, which none of these users are granted. The issue is i need to push out roughly 50 of these and want zero user interaction or interaction from the help desk to enter the admin creds...

2 REPLIES 2

c0n0r
Contributor

Try

su - $logged_in_user -I -F /tmp/ml0154927_ILA.mobileconfig

rqomsiya
Contributor III

No go.. tried that and got this error when i ran the scipt via terminal as root:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
/usr/bin/profiles: /usr/bin/profiles: cannot execute binary file