[Casper] Getting rid of the "shared" computers list in the sidebar
Kevin Bernstein
bernstein.kevin at gene.com
Thu Jul 17 19:15:14 PDT 2008
I run a shell script to handle this. Here's my code for this:
> #!/bin/sh
> #
> # Created by Kevin Bernstein on 2008-06-13. All rights reserved.
> #
> export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/lib:/usr/
> local/include:/usr/bin:/bin:/usr/sbin:/sbin"
>
>
> LEOUSERLIST=`dscl . list /Users home | awk '/Users/ { print $1 }'`
> USERNAMES=(${LEOUSERLIST})
>
> echo "";echo "* * * * Sidebar Update"
> for (( i = 0 ; i < ${#USERNAMES[@]} ; i++ ))
> do
> USERSFOLDER=`dscl . -read /Users/${USERNAMES[$i]} home | awk -s
> {'print $2'}`
> if [[ -e $USERSFOLDER/Library/Preferences/
> com.apple.sidebarlists.plist ]]; then
> /usr/libexec/PlistBuddy -c
> "set
> :networkbrowser:CustomListProperties:com
> .apple.NetworkBrowser.bonjourEnabled false" $USERSFOLDER/Library/
> Preferences/com.apple.sidebarlists.plist
> chown ${USERNAMES[$i]} $USERSFOLDER/Library/Preferences/
> com.apple.sidebarlists.plist
> chmod 600 $USERSFOLDER/Library/Preferences/
> com.apple.sidebarlists.plist
> echo "updated sidebar setting for ${USERNAMES[$i]}'s existing
> pref" `defaults read $USERSFOLDER/Library/Preferences/
> com.apple.sidebarlists networkbrowser | grep
> com.apple.NetworkBrowser.bonjourEnabled | awk {'print$1,$3'}`
> else
> touch $USERSFOLDER/Library/Preferences/com.apple.sidebarlists.plist
> /usr/libexec/PlistBuddy -c
> "set
> :networkbrowser:CustomListProperties:com
> .apple.NetworkBrowser.bonjourEnabled false" $USERSFOLDER/Library/
> Preferences/com.apple.sidebarlists.plist
> chown ${USERNAMES[$i]} $USERSFOLDER/Library/Preferences/
> com.apple.sidebarlists.plist
> chmod 600 $USERSFOLDER/Library/Preferences/
> com.apple.sidebarlists.plist
> echo "created sidebar pref for ${USERNAMES[$i]} and set it to
> disallow Bonjour shares" `defaults read $USERSFOLDER/Library/
> Preferences/com.apple.sidebarlists networkbrowser | grep
> com.apple.NetworkBrowser.bonjourEnabled | awk {'print$1,$3'}`
> fi
> done
>
> exit 0
I realize there are no comments. Sorry. But basically, this querries
the local system to find the home directory of every user, then
iterates through the accounts attempting to update their
com.apple.sidebarlists.plist. If a plist is found then it updates it.
Otherwise if not found, it creates it and writes the preferences. It
uses PListBuddy (which I found easier to use for this situation).
PListBuddy may or may not be in /usr/libexec by default, but is hard
coded in this script. Also there's also some chmod and chown code as
this runs as root in a postflight script. I have only tested this with
local users, so I don't know what the experience would be like for
network home users.
NOTE: I have just joined the list for device management ideas. I do
not use Casper Suite... but believe this could be pushed out using the
scripting interface or pushed as a package, where the above is a
postflight script.
Kevin Bernstein
Desktop Engineering & Support
On Jul 17, 2008, at 2:26 PM, casper-request at list.jamfsoftware.com wrote:
> Send Casper mailing list submissions to
> casper at list.jamfsoftware.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://list.jamfsoftware.com/mailman/listinfo/casper
> or, via email, send a message with subject or body 'help' to
> casper-request at list.jamfsoftware.com
>
> You can reach the person managing the list at
> casper-owner at list.jamfsoftware.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Casper digest..."
>
>
> Today's Topics:
>
> 1. Re: Getting rid of the "shared" computers list in the sidebar
> (Leacy, Miles)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 17 Jul 2008 17:25:21 -0400
> From: "Leacy, Miles" <Miles.Leacy at PoloRalphLauren.com>
> Subject: Re: [Casper] Getting rid of the "shared" computers list in
> the sidebar
> To: John DeTroye <detroye1 at apple.com>, Casper Listserv
> <casper at list.jamfsoftware.com>
> Message-ID: <C4A53101.394A%Miles.Leacy at PoloRalphLauren.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Thanks, John. That?s it.
>
> If you?re not using WGM/MCX, ?defaults write? is your friend. Just
> remember
> that this is a per-user preference. A script in a Casper policy
> triggered
> at every login will simulate the ?often? frequency in WGM. Just
> make sure
> to target ~/Library.
>
> John, are you saying if you set the prefs to ?often? in WGM, then
> the client
> re-enables sharing in the Finder prefs, then the client logs out and
> logs
> back in, that the shared prefs do *not* go back to their managed
> state? The
> behavior you describe is the intended function of ?often?. ?Often?
> sets
> your indicated preference at login, but the client can change it
> during
> their logged in session. At their next login, the preference should
> return
> to its managed state.
>
> If you want a setting to be managed, stay managed, and not be
> alterable by
> the client, you need to use the ?always? frequency.
>
> Am I misunderstanding? Is this preference behaving differently?
>
>
> On 7/17/08 5:06 PM, "John DeTroye" <detroye1 at apple.com> wrote:
>
>> 1. Set the Sidebar prefs on your admin system to show nothing in
>> "Sharing"
>> 2. In WGM/Prefs/Details, add your com.apple.sidebarlists.plist to
>> "Often"
>> 3. Remove all but the following from the entry:
>>
>>
>>
>> 4. All of your bound clients will have the "Sharing" section turned
>> off.
>> Note: If the user turns any portion of it back on in Finder/
>> Preferences, the
>> "Sharing" will return (escalations might get this fixed... hint,
>> hint)
>>
>> Of course you are using WGM/MCX to manage your Mac preference
>> policies, right?
>>
>> :-)
>>
>>
>
> --
> Miles Leacy
> Senior Mac Technologist
> ACTC|ACSA|ACT|CCA
> Polo Ralph Lauren
> 212-318-7603
> miles.leacy at poloralphlauren.com
>
>
>
>
>
>
>
>
>
> This message and any attached documents contain information which
> may be confidential, subject to privilege or exempt from disclosure
> under applicable law. These materials are intended only for the use
> of the intended recipient. If you are not the intended recipient of
> this transmission you are hereby notified that any distribution,
> disclosure, printing, copying, storage, modification or the taking
> of any action in reliance upon this transmission is strictly
> prohibited. Delivery of this message to any person other than the
> intended recipient shall not compromise or waive such
> confidentiality, privilege or exemption from disclosure as to this
> communication. If you have received this communication in error,
> please immediately notify the sender and delete the message from
> your system.
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://list.jamfsoftware.com/pipermail/casper/attachments/20080717/7bb07616/attachment.htm
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: image/png
> Size: 15609 bytes
> Desc: not available
> Url : http://list.jamfsoftware.com/pipermail/casper/attachments/20080717/7bb07616/attachment.png
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: image/png
> Size: 5731 bytes
> Desc: not available
> Url : http://list.jamfsoftware.com/pipermail/casper/attachments/20080717/7bb07616/attachment-0001.png
>
> ------------------------------
>
> _______________________________________________
> Casper mailing list
> Casper at list.jamfsoftware.com
> http://list.jamfsoftware.com/mailman/listinfo/casper
>
>
> End of Casper Digest, Vol 19, Issue 18
> **************************************
More information about the Casper
mailing list