I have a script that I'm running that installs new certificates into keychain. The only issue I'm running into is that it prompts the user for local admin credentials when we remove the old configuration profile and when it adds the new configuration profile to save the certificate into the keychain.
The script has to run as the local user so that it downloads the certificates as the user. Anyone know of a way to do this? Thanks!
find current user logged in
currentuser=stat -f "%Su" /dev/console
profile1=su "$currentuser" -c "/usr/bin/profiles -Lv | grep LC-802-1x-User"
profile2=echo $profile1 | awk '{print $4}'
echo $profilename
if [[ $profile2 == "LC-802-1x-User" ]]; then
su "$currentuser" -c "/usr/bin/profiles -R -p 04D1878B-BD77-4593-BAA4-4EB5AAE99304"
else
echo profile not found
fi
run profiles command as current logged in user
su "$currentuser" -c "/usr/bin/profiles -I -F /Library/LC/LC-802-1x-User.mobileconfig"