Skip to main content
Question

Sidebar : Disable Back to my Mac and Bonjour with config profile.

  • June 9, 2016
  • 9 replies
  • 47 views

Forum|alt.badge.img+14

I am trying to disable these sidebar items with a config profile:
domain: com.apple.sidebarlists
user level
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict> <key>networkbrowser</key> <dict> <key>CustomListProperties</key> <dict> <key>com.apple.NetworkBrowser.backToMyMacEnabled</key> <false/> <key>com.apple.NetworkBrowser.bonjourEnabled</key> <false/> </dict> </dict>
</dict>
</plist>

does not work at ALL!

9 replies

Forum|alt.badge.img+12
  • Valued Contributor
  • June 9, 2016

Does running this command, then reloading the profile, help?:

sudo killall cfprefsd

Forum|alt.badge.img+14
  • Author
  • Valued Contributor
  • June 9, 2016

i did a killall cfprefsd and restarted the finder.


Forum|alt.badge.img+14
  • Author
  • Valued Contributor
  • June 10, 2016

I abandoned the cfg profile because they give me headaches and instead am using a script to modify the sidebar. I made a plistbuddy command but the problem is that com.apple.sidebarlists does not get born until you modify the defaults, which it inherits from ... somewhere ... The if [ -e is so when I finally use this, only newly imaged machines will have the script run. I am distributing mysides at imaging time, and this is for new builds only. I used sfltool because I wanted to get familiar with it. the mysides lines I copied from another thread here.

#!/bin/bash
# Get the Username of the currently logged user
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
if [ -e /usr/local/bin/mysides ]
then
su - "$loggedInUser" -c "/usr/local/bin/mysides remove All My Files file:///System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries/myDocuments.cannedSearch/" && sleep 2
su - "$loggedInUser" -c "/usr/local/bin/mysides remove iCloud x-apple-finder:icloud" && sleep 2
su - "$loggedInUser" -c "/usr/local/bin/mysides remove domain-AirDrop nwnode://domain-AirDrop" && sleep 2
su - "$loggedInUser" -c "/usr/local/bin/mysides remove domain-Bonjour nwnode://domain-Bonjour" && sleep 2
/usr/bin/sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///Users/$loggedInUser && sleep 2
/usr/bin/sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///Users/$loggedInUser/Desktop && sleep 2
/usr/bin/sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///Users/$loggedInUser/Documents && sleep 2
/usr/bin/sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///Users/$loggedInUser/Downloads && sleep 2
/usr/bin/sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///Users/$loggedInUser/Movies && sleep 2
/usr/bin/sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///Users/$loggedInUser/Music && sleep 2
/usr/bin/sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///Users/$loggedInUser/Pictures && sleep 2
touch /Users/$loggedInUser/.sidebarshortcuts
fi
/usr/libexec/PlistBuddy -c "Add :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.backToMyMacEnabled bool False" /Users/$loggedInUser/Library/Preferences/com.apple.sidebarlists.plist
/usr/libexec/PlistBuddy -c "Add :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.bonjourEnabled bool False" /Users/$loggedInUser/Library/Preferences/com.apple.sidebarlists.plist

Maybe I just need to sleep after the touch command?


Forum|alt.badge.img+14
  • Author
  • Valued Contributor
  • June 10, 2016

Ok that works, but doesn't seem to take effect until after a reboot?


Forum|alt.badge.img+10
  • New Contributor
  • June 10, 2016

@djdavetrouble have you scene this thread?


Forum|alt.badge.img+14
  • Author
  • Valued Contributor
  • June 10, 2016

Hey, it totally works! the check boxes remain unchanged on backtomymac and bonjour until a full reboot. I am working on that now. I have seen that thread, seems a little dated. Anyway, the cfg profile didn't work and this does.


  • August 9, 2016

Hope you don't mind, but I'm using your script and it works great, but no matter what I try I simply cannot get any of the Network Browser stuff to hide. I don't want my users seeing any of it; Back To My Mac, Bonjour or Connected Servers, the script is writing to the plists fine, it just ignores the settings though. Any ideas?

/usr/libexec/PlistBuddy -c "Add :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.backToMyMacEnabled bool False" /home/$loggedInUser/Library/Preferences/com.apple.sidebarlists.plist
/usr/libexec/PlistBuddy -c "Add :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.connectedEnabled bool False" /home/$loggedInUser/Library/Preferences/com.apple.sidebarlists.plist
/usr/libexec/PlistBuddy -c "Add :networkbrowser:CustomListProperties:com.apple.NetworkBrowser.bonjourEnabled bool False" /home/$loggedInUser/Library/Preferences/com.apple.sidebarlists.plist

Forum|alt.badge.img+14
  • Author
  • Valued Contributor
  • September 6, 2016

I trigger as login, when are you running the script?


  • January 18, 2017

@djdavetrouble Also at login.