Hello,
I'm trying to configure NoMAD through Jamf for all of the machines I run, but I'm running into a snag since the config has to be in the local users' home directory and I'm hoping someone here can provide some insight.
I found a login script from a user (Thanks @PaulHazelden) last year which is listed here:
AD_domain="your ad server"
Realm="YOUR AD SERVER"
# Write default AD domain
defaults write com.trusourcelabs.NoMAD ADDomain -string "$AD_domain"
defaults write com.trusourcelabs.NoMAD KerberosRealm -string "$Realm"
defaults write com.trusourcelabs.NoMAD UseKeychain -bool "true"
defaults write com.trusourcelabs.NoMAD SignInWindowOnLaunch -bool "true"
defaults write com.trusourcelabs.NoMAD UPCAlert -bool "true"
defaults write com.trusourcelabs.NoMAD UseKeychainPrompt -bool "true"
My problem is that scripting this through Jamf results in the defaults command writing to the root folder rather than the Users'.
I tried prepending each line with "sudo -u $USER" and expanding the plist location to /Users/$USER/Library/Preferences/com.trusourcelabs.NoMAD but they are still writing to the root user folder since the user running the command is root.
My next approach was to write a for loop and have it run against all of the directories in /Users:
for DIR in $(find /Users -maxdepth 1 -type d)
do
defaults write "$DIR"/Library/Preferences/com.trusourcelabs.NoMAD.plist ADDomain -string "$AD_domain"
done
with all of the same plist entries in the original script.
This is writing to the correct plists for all of the users, but I have to run a chmod o+rwx on the plist after the fact. It is also creating some new folders in /Users for 2 reasons:
1. The find command returns /Users as one of the directories, so the defaults command is writing to /Users/Library...
2. If any user folders have a space (ie Deleted Users), that space is carried into the command regardless of quotes used and creates a folder for the first half (ie Deleted).
Hoping that some of you scripting geniuses who haven't been staring at this for two days like I have would have a solution to my problem.
Thanks!