• 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,  Mac Security,  Mass Deployment

    Mac OS X: User Templates

    New users on a Mac have a certain set of default settings that are copied into their user profiles the first time they log in from the contents of the /System/Library/User Template/English.lproj directory.  You can drop files into this directory or edit files that are already there that will then be copied into new accounts when they’re created, allowing you to customize the look and feel, default documents, fonts and other aspects of user accounts without having to do so each time a new user is created or logged into a system.   This can be incredibly useful for scenarios where you are not using network accounts or mobile accounts…

  • Mac OS X,  Mac OS X Server

    Creating a LaunchAgent

    If you want to make a program start at a certain time or always run on Mac OS X then you should use launchd. Launchd can start your web, FTP or SMB daemon’s or even an application or open a file. Launchd uses property lists to identify various parameters for the agents you will be creating. Using Property List editor, create a new list and add the following items: Root dictionary Label string ProgramArguments array OnDemand boolean Set if we are going to use TextEdit as an example, then set them like so: Label: com.apple.TextEdit OnDemand: false ProgramArguments: one child, a string: /Applications/TextEdit.app/Contents/MacOS/TextEdit Save this file in ~/Library/LaunchAgents/com.apple.TextEdit.plist or /Library/LaunchAgents/com.apple.TetEdit.plist…