Posted on 10-05-2011 11:15 AM
Hi guys,
Pretty sure I used to have a way of running the defaults write command as the logged user from a policy, but I can't remember it!
So far, I've tried grabbing the logged in users shortname.. Then running the defaults command with the full path to the plist.. But no luck.
Any ideas?
Regards,
Ben.
Posted on 10-05-2011 12:10 AM
Thanks.
Just remembered this is why I post things on my blog, I forget otherwise!!
This is from a screensaver script:
# Sets screen saver to require password (not always needed)
/usr/bin/defaults write "$loggedInUserHome"/Library/Preferences/ByHost/com.apple.screensaver."$LEOUUID" "Require Password" -bool TRUE
#
#Correctng Permissions for /Users/loggedInUser/Library/Preferences/ByHost/com.apple.screensaver.UUID
chmod 777 "$loggedInUserHome"/Library/Preferences/ByHost/com.apple.screensaver."$LEOUUID".plist
Regards,
Ben.
Posted on 10-05-2011 11:32 AM
sudo -s -u <username> defaults write com.someplist.plist -options -arguments
This is not tested, see the sudo man page. Also you can deploy user agents, they always run as the user
Posted on 10-05-2011 11:50 AM
sudo -s -u <username> defaults write com.someplist.plist -options -arguments
On 10/5/11 1:32 PM, "Thomas Larkin" <tlarki at kckps.org<mailto:tlarki at kckps.org>> wrote:
This is not tested, see the sudo man page. Also you can deploy user agents, they always run as the user
Be sure to omit the ".plist" from the command but if necessary you can specify the path to the file.
--
William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492
Posted on 10-05-2011 01:14 PM
what are you trying to do with this that can't be done with mcx?
i'd avoid a complicated solution here, if possible. maybe you can outline your intentions.
Posted on 10-05-2011 01:23 PM
No mcx in use.
The below's an excerpt from a script manage screen savers.
This new issue is to set the default paper size to A4 if not set to any A size.
@ build we'll have a plist to set the default (with fut).
If we used mcx it'd be an once setting.
I've always used mcx, but only to hide sys prefs & mount drives.
This new environment has far too many groups, so could only set computer level... But tbh, can't see the need.
Regards,
Ben.