• Mac OS X,  Mass Deployment

    LoginHook Bonjour

    Want users to be able to use Bonjour at home without having their systems registering with Bonjour when they’re on your network? Many environments have taken to wholesale disabling Bonjour. This can be done by augmenting the LaunchDaemon that invokes Bonjour, com.apple.mDNSResponder.plist that is located at /System/Library/LaunchDaemons. You add a -NoMulticastAdvertisements to the ProgramArguments array. This can be done with the defaults command as so: defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ProgramArguments -array-add “-NoMulticastAdvertisements” This can then be undone by writing the contents you want back into the array without the -NoMulticastAdvertisements: defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ProgramArguments -array /usr/sbin/mDNSResponder -launchd This is somewhat well documented, initially appearing as an Apple kbase article. However, we…

  • Mac OS X Server

    Monitoring/Restarting Retrospect

    As of version 8, Retrospect uses port 22024 when the Retrospect Console needs to communicate with the engine. It just so happens that this can become unresponsive when the engine itself decides to stop working. Therefore, if you’re using Retrospect 8, you can run a port scan against port 22024 ( i.e. stroke <IP_ADDRESS> 22024 22024 ) and then restart the engine if it goes unresponsive. To restart the engine, simply unload and then load com.retrospect.launchd.retroengine. For example: /bin/launchctl unload /Library/LaunchDaemons/com.retrospect.launchd.retroengine.plist; /bin/launchctl load /Library/LaunchDaemons/com.retrospect.launchd.retroengine.plist I have found that if you alter the nice value that the engine crashes less (not that I’m saying that it crashes a lot or is buggy…

  • Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment,  Xsan

    Programatic Screen Sharing

    You can remotely start ARD with kickstart, which I have previously covered at length. But Screen Sharing is a bit of a different little beast. To start up Screen Sharing, you can just use the following command: echo -n enabled > /Library/Preferences/com.apple.ScreenSharing.launchd I still prefer kickstart, but this method functions when you need something quick and easy. To then disable Screen Sharing, you can just toss the launchd item: rm /Library/Preferences/com.apple.ScreenSharing.launchd Once you have Screen Sharing started, you can then open the Screen Sharing application from a client by using the open command, followed by the protocol, which would be vnc and then the IP address. As with FTP you…

  • Mac OS X Server,  Mac Security

    Finishing RADIUS Kbase Article for AAPL

    Troubleshooting radius is a crappy task. But crappy articles don’t help: http://support.apple.com/kb/HT3929 To be more specific, the debug mode flag is -X (not sure why that was so hard). In that case it’s doing single server mode and the process cannot fork. You can also do the lowercase, -x (which is part of -X), or -xx for further granularity. In order to set the launchd item to debug mode you would therefore find the /System/Library/LaunchDaemons/org.freeradius.radiusd.plist file (only created once you’ve fired up RADIUS btw). From here, locate the array for invoking the command: <string>/usr/sbin/radiusd</string> <string>-sf</string> Change the -sf to either a -X or add an x or two in there…

  • Mac OS X,  Mac Security,  Mass Deployment

    Self Destructing Scripts

    I have mentioned creating a self destructing script or launchd item a few times in articles on this site. But it was recently pointed out that I never actually showed how to go about doing so. Until recently I would actually use an out-of-band script to remove a script, a launchd agent or a launchd daemon. However, this would invariably leave elements somewhere on a file system of the script. For example, within a script I would echo out another script, fire off that script and then use it to delete (rm) the original script. When I planned out a deployment or a series of scripts I would always have…

  • Mac OS X,  Xsan

    Mac OS X: Enable and Disable Spotlight

    To Disable Spotlight for Mac OS X you can stop the Spotlight processes from being invoked by launchd.  To do so use the following commands: launchctl unload -w /System/Library/LaunchAgents/com.apple.Spotlight.plist launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist To re-enable it you would simply load up your launchd processes again like so: launchctl load -w /System/Library/LaunchAgents/com.apple.Spotlight.plist launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

  • Mac OS X

    Mac OS X: SystemStarter

    Ever wonder why those things you put into /System/Library/StartupItems and /Library/StartupItems start automatically?  SystemStarter. System starter automatically starts up items stored in /Library/StartupItems and /System/Library/StartupItems.  As Mac OS X continues to transition much of the previous functionality of other facilities such as the cron daemon into launchd, development has also reduced the reliance on SystemStarter since Mac OS X 10.3.  However, many third-party applications do still use StartupItems, Apple development prefers the launchd facility and will continue to rely more heavily on it in 10.6 and beyond.  

  • Mac OS X,  Mac OS X Server,  Mac Security

    Mac OS X: launch daemons vs launch agents

    There are two types of services that launchd manages: launch daemons can run without a user logged in. Launch daemons cannot display information using the GUI. Launch daemon configuration plist files are stored in the /System/Library/LaunchDaemons folder (for those provided by Apple et al) and /Library/LaunchDaemons (for the rest).  Launch agents run on behalf of a user and therefore need the user to be logged in to run.  Launch agents can display information through the window server. As with launch daemons, launch agent configuration plist files are stored in the /System/Library/LaunchAgents and /Library/LaunchAgents. User launch agents are installed in the ~/Library/LaunchAgents folder.