Skip to main content

Can someone is able to explain to me why this script works locally but when I try to run it from the Jamf server it does not fail but it does nothing. the echo give me the actual login user in the logs.



#!/bin/bash

currentuser=""
currentuser=`/bin/ls -la /dev/console | /usr/bin/cut -d " " -f 4`
echo $currentuser

defaults write /Users/$currentuser/Library/Preferences/com.apple.Safari ManagedPlugInPolicies ' "com.macromedia.Flash Player.plugin" = {
PlugInDisallowPromptBeforeUseDialog = 1;
PlugInFirstVisitPolicy = PlugInPolicyAllowWithSecurityRestrictions;
PlugInHostnamePolicies = (
{
PlugInHostname = "www.adobe.com";
PlugInIsFreshlyExpired = 0;
PlugInPageURL = "http://www.adobe.com/uk/software/flash/about/";
PlugInPolicy = PlugInPolicyAllowWithSecurityRestrictions;
PlugInRunUnsandboxed = 1;
}
);
PlugInRunUnsandboxedOnFirstVisit = 1;
};
'
exit 0

Might want to move this into a Configuration Profile. Much easier to manage.



You have currentuser listed twice?


@donmontalvo I'm assuming he's setting current user as null first just to make sure it's empty to start with. Not really something done in bash. It could probably be removed and it would be fine.


Reply