Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Apple > Operating Systems

  • Print
  • + Share This
This chapter is from the book

Customizing System Configuration

In this section, you will learn to perform advanced customizations to further optimize your system image for deployment. All the custom configurations demonstrated in this section are optional and can be used individually. However, including them in your system image allows you to present the user with a Mac system that is tightly integrated with your organization and its policies.

Rerunning the Setup Assistant

The Setup Assistant is the first interface most Mac OS X users see when they start a new Mac for the first time. The Setup Assistant guides the user through the process of configuring initial settings, including the creation of an administrative user account. However, after this initial setup is complete, the Setup Assistant no longer appears at startup. You can force the Startup Assistant to run at the next system startup to give users some control over their own computers, including the ability to create their own user accounts.

If you want to make the Startup Assistant run at the next system startup, simply remove the /var/db/.AppleSetupDone file. If you also want Setup Assistant to present the user with a choice to bind to a directory server, remove /var/db/.AutoBindDone. These files are protected by root access, so the quickest method to remove them is to enter sudo rm /var/db/.AppleSetupDone and sudo rm /var/db/.AutoBindDone at the command line. When a user restarts the computer, the Setup Assistant will launch, allowing the user to make several configuration changes. This potentially includes changes that are not ideal for your deployment, including the following:

  • The user will be allowed to set the default keyboard and language, enter registration information, his Apple ID, and MobileMe information, and reset the time zone.
  • If networking is already set up, the user will not be allowed to configure any network settings at this point.
  • If you remove the .AutoBindDone file, the user will be able to bind to a network directory service.
  • The user will be able to create an additional administrative user account.
  • The Setup Assistant will enable automatic login for the newly created user.
  • The Setup Assistant will change the computer’s name using the following convention: new user’s name followed by the computer model.

Unfortunately, you cannot limit what the Setup Assistant allows the user to configure. If you still want to use the Setup Assistant but you need to limit the changes, you can implement a script to automatically reset some of these items after the Setup Assistant finishes. Techniques for implementing such a script at first startup is covered in Chapter 6, “Postimaging Deployment Considerations.” If you change your mind about restarting the Setup Assistant, you can easily replace the appropriate files by entering sudo touch /var/db/.AppleSetupDone or sudo touch /var/db/.AutoBindDone at the command line.

Customizing the Setup Assistant

To customize your users’ new Mac experience, you can change the QuickTime video and MP3 audio files played at the introduction of the Setup Assistant. You can use any content-creation tool you like to create custom organization-specific replacements for these files. For instance, you could create a movie that reminds the user of your organization’s usage policies, or you could create replacements that essentially play nothing. When creating your custom introduction media, keep in mind that the video and audio files start playing simultaneously, but the video ends before the audio file to allow the user to continue the setup process accompanied by background music.

The files you must replace are located inside the Setup Assistant package, in the /System/Library/CoreServices/Setup Assistant.app/Contents/Resources/TransitionSection.bundle/Contents/Resources folder. In this folder you will need to replace the intro.mov and intro-sound.mp3 files. These files are protected by root access, and you should back them up just in case you need to return the Setup Assistant to its original state.

In the following example, Michelle uses the command line to back up the original audio and video files, and then replace them with two custom files that she has created on her desktop. Michelle first navigates to the appropriate folder inside the Setup Assistant package. Notice that she uses the sudo command to bypass the file-system permissions.

MyMac:~ michelle$ cd "/System/Library/CoreServices/Setup Assistant.app/Contents/
Resources/TransitionSection.bundle/Contents/Resources"
MyMac:Resources michelle$ sudo mv intro.mov intro.mov.old
MyMac:Resources michelle$ sudo mv intro-sound.mp3 intro-sound.mp3.old
MyMac:Resources michelle$ sudo cp /Users/michelle/Desktop/custommoive.mov intro.mov
MyMac:Resources michelle$ sudo cp /Users/michelle/Desktop/customsong.mp3 intro-sound.mp3

Customizing the Login Screen

You can also customize the login screen to meet your organization’s deployment needs; for instance, display information such as usage policies. Ideally, you should configure custom login screen settings using managed preferences settings hosted on a directory server. Workgroup Manager (WGM) includes a specific Login preferences interface for easily configuring the login screen behaviors and appearance. Using managed preferences is covered in the “Integrating with Managed Preferences” section previously in this chapter.

However, if you have decided against deploying managed preferences settings, you can configure login screen settings on your model system and make them part of your system image deployment. The login screen is managed by the loginwindow process, which references settings located in the /Library/Preferences/com.apple.loginwindow.plist preference file. You could edit this file using the Property List Editor application included with the Xcode Tools suite, but it’s much quicker to use the defaults write command to customize this file. Because the file is protected by root permissions, you would use the sudo command to bypass those restrictions.

Using the defaults command, you must add a new property key, LoginwindowText, to the loginwindow preference file. The value for this new key will be the string of text you want shown at the login window inside quotation marks. For example, to customize the login window text with a usage policy notice, you would enter the following at the command line:

sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText
"By logging in to this computer you are agreeing to the usage policies found in
Pretendco document UP-1052. Thank you, and have a nice day."

To test your custom configuration, log out of your current session and observe the login screen behavior.

Customizing the Desktop Background and User Template

Some deployments require a static desktop background as part of their deployment policy. It’s common in open or lab environments to maintain a consistent desktop background between sessions. Perhaps the desktop background includes instructive text or administrator support information that you have decided should always be easily available.

In Mac OS X the desktop background is a per-user preference, so every user is allowed to set her own background. This makes permanently setting the background for all users a bit more complex. There are two methods for accomplishing it; use managed preferences, or modify the user template on your model system. Again, as you’ll see, the best solution is to set the desktop background using managed preferences.

Set the Desktop Background

Either method you choose requires that the desktop picture be located on the local Mac and locked from editing. So the first step is to prepare and secure the desktop background image file on your model system.

To install, set, and protect a custom desktop background picture:

  1. Log in to your model computer with an administrative account.
  2. Place the image file you want to set as the desktop background in a location that all users will be able to access, such as the /Library/Desktop Pictures folder.
  3. Open the Desktop & Screen Saver preferences and set the desktop background for the administrative account to the desired image file. You will have to drag the image file from the desktop into the image well area at the upper-left corner of the preference pane.
  4. Set any additional desktop background features, and then close the Desktop & Screen Saver preferences.

    This creates a properly formatted desktop property list preference file in the administrator’s home folder.

  5. Protect the desktop image file from modification. This requires changing the files’ ownership to be writable only by root but still readable by everyone else.

    Again, because this image file will have root permissions, the quickest method is to use the command line. In the following example, Michelle changes the ownership for the pretendco.jpg image file.

    MyMac:~ michelle$ <font color="#658CA6">sudo chown root:wheel "/Library/Desktop Pictures/pretendco.jpg"</font>
    
  6. Now that you have set the desktop background and protected the selected image from changes, use one of the methods in the next two sections to permanently set the background for all users.

Use Managed Preferences to Force a Desktop Background

Once you have set the desktop background on a model system, it takes only a few steps to apply that setting as a custom managed preference. Again, this instruction assumes you are familiar with the topics outlined in the “Integrating with Managed Preferences” section earlier in this chapter.

To configure managed preferences to force a desktop background:

  1. Make sure you are logged in to your model Mac with the administrative account that you used previously to set the custom desktop background.
  2. Open /Applications/Server/Workgroup Manager.app and authenticate to the directory that will be hosting the custom managed preference.
  3. Select the account(s) that you wish to manage, click the Preferences button in the toolbar, and click the Details tab. This will reveal WGM’s preference editor interface.

    If you have previously configured managed preference settings using WGM’s normal graphical interface you will see those items in the preference editor list with a pointer icon adjacent to the items’ names.

  4. To import the desktop background preferences, click the small plus button at the bottom of the preference editor list and an import dialog will appear.
  5. Browse to and select the ~/Library/Preferences/com.apple.desktop.plist file.
  6. Make sure Always is selected as the management option and then click the Add button to import your desktop settings into WGM.
  7. You will return to the Details view, then double-click on the Desktop Picture preference. This will open the preference editor, allowing you to verify the desktop background setting.
  8. Click the disclosure triangle next to Always to reveal the imported key/value pairs. The import will have included many extraneous key/value pairs that you will need to delete.
  9. Select and delete all items except for Background > Default Image > Image Path. The results should look like the following screen shot.
  10. When you have completed the necessary managed preference modifications, click the Apply Now button to save the changes.

    Again, note the small arrow icon next to any preference that is being managed.

  11. To test the settings, log in to another user account and verify that your desktop background has been set and that you cannot change it from the Desktop & Screen Saver preferences.

Modify the User Template to Force a Desktop Background

Whenever a local or mobile user account is created, the system also creates a local home folder for that user. The contents of these created home folders are based on the system’s user template. You can customize this user template to prepopulate new users’ home folders with any items, including preference settings.

As always, the ideal solution to set specific user settings is to use managed preferences, as covered previously in this chapter. However, as an alternative solution, you can place user-specific preference files containing the settings in the user template on your model system and make them part of your system image deployment.

Thus, you can customize the user template to set a default background for every user. However, the desktop background is saved as a per-user setting, and the user can normally change it at any time from the Desktop & Screen Saver preferences. To prevent the user from making this change, you will have to set special permissions that lock the preference file from changes.

To modify the user template to force a desktop background:

  1. Make sure you are logged in to your model Mac with the administrative account that you used previously to set the custom desktop background.
  2. Copy the com.apple.desktop.plist file from the administrative account’s ~/Library/Preferences folder to the appropriate folder in the user template: /System/Library/User Template/English.lproj/Library/Preferences/.

    This folder is protected by root access, so you will have to use the command line to copy this file into the appropriate location. In the following example, Michelle uses her administrative account to copy the desktop preference file into the user template.

    MyMac:~ michelle$ sudo cp "/Users/michelle/Library/Preferences/com.apple.desktop.
    plist" "/System/Library/User Template/English.lproj/Library/Preferences/"
    
  3. Protect the desktop preference file from modification. This requires changing the files’ ownership and permissions to be writable only by root but still readable by everyone else, and then setting the lock flag.

    Again, because these items will have root permissions, the quickest method is to use the command line. In the following example, Michelle changes the ownership, permissions, and lock flag for the desktop preference file inside the user template.

    MyMac:~ michelle$ sudo chown root:wheel "/Library/Desktop Pictures/pretendco.jpg"
    "/System/Library/User Template/English.lproj /Library/Preferences/com.apple.
    desktop.plist"
    MyMac:~ michelle$ sudo chmod 644 "/Library/Desktop Pictures/pretendco.jpg" "/System/
    Library/User Template/English.lproj /Library/Preferences/com.apple.desktop.plist"
    MyMac:~ michelle$ sudo chflags uchg "/Library/Desktop Pictures/pretendco.jpg"
    "/System/Library/User Template/English.lproj /Library/Preferences/com.apple.
    desktop.plist"
    

Normally when the user template items are copied to create the new user’s home folder, the ownership and permissions are set so the items belong to the user. However, because you set the lock flag, the copied desktop preference file will retain the original ownership and permissions you have set here. Thus, users will not be allowed to change the desktop background setting even if they have access to the Desktop & Screen Saver preferences. The system preference will remain active and allow the user to interact with the settings, but the desktop background will never change.

Creating a Hidden Administrator

Perhaps the cleverest advanced customization you can make to your model image is hiding the local administrative user’s account from the primary users of the computer. If the administrator’s account isn’t hidden, users can view the local user list at the login window, the fast user switching menu, and the Accounts preference; they can also see other users’ home folders in the /Users folder from the Finder and command line and when connecting remotely to a Mac that has file-sharing services enabled.

The technique covered here will hide all these clues from every user and will even hide the account from other administrative users. Although an administrative user who knows exactly what to look for can easily uncover and delete your hidden administrator, the vast majority of users will have no idea that the account is even there.

To create a local hidden administrative account:

  1. Log in to your model computer with an administrative account.
  2. Open the Accounts system preference, click the Login Options button, and set “Display login window as” to “Name and password.” Disable automatic login if you haven’t done so already.
  3. While still in the Accounts system preference, create a new administrative user account. Choose an appropriate short name as this user’s primary login name. Also, do not activate FileVault for this user. Click Create Account when you are done.
  4. In the accounts list, right-click or Control-click the entry for your new administrative account and choose Advanced Options from the shortcut menu.
  5. In the Advanced Options dialog, change the user ID to 499 and the home directory location to any path that an average user would never navigate to. For instance, you could choose any folder normally hidden in the Finder. Then click OK.

    A good location to store the hidden administrator’s home folder is inside the /var folder. You can further “hide” the home folder by giving the home folder a name that begins with a period. For example, if your hidden administrator’s short name is hadmin, a good hidden home folder path would be /var/.hadmin.

  6. Move and rename the hidden administrator’s home folder and set the appropriate ownership.

    Step 5 changed the hidden administrator’s user record, but in doing so you effectively removed access to this account’s original home folder. You must move the original home folder to the new path you chose in step 5 and correct the ownership for the home folder items.

    Because you’re modifying another user’s home folder, the fastest method to restore access is to use the command line. In the following example, Michelle will move and rename the hidden administrator’s home folder, and then set the appropriate ownership.

    MyMac:~ michelle$ sudo mv /Users/hadmin /var/.hadmin
    MyMac:~ michelle$ sudo chown –R hadmin /var/.hadmin
    
  7. Remove the Public and Sites folders from the hidden administrator’s home folder.

    Even though we have moved the hidden administrator’s home folder, it may still show up when various network sharing services are enabled. This is easily remedied by removing the Public and Sites folders from this home folder.

    Again, because you’re modifying another user’s home folder, the fastest method is to use the command line. In the following example, Michelle will remove the shared folders in the hidden administrator’s home folder.

    MyMac:~ michelle$ sudo rm –R /var/.hadmin/Public /var/.hadmin/Sites
    
  8. Modify the loginwindow settings so the hidden administrator account and any account with user IDs below 500 are not shown. This will also prevent the Accounts preference and the fast user switching menu from showing accounts with user IDs below 500.

    The quickest method to set these custom settings is to use the defaults command. Note that you could also set this using custom managed preferences, as covered previously in this chapter. In the following example, Michelle will modify the loginwindow preferences to hide accounts with user IDs below 500, and then hide the hadmin account.

    MyMac:~ michelle$ sudo defaults write /Library/Preferences/com.apple.loginwindow
    Hide500Users -bool TRUE
    MyMac:~ michelle$ sudo defaults write /Library/Preferences/com.apple.loginwindow
    HiddenUsersList -array hadmin
    
  9. Test your work by logging out of your current account and then logging in as the hidden administrator.
  10. If everything is working properly, delete your initial administrator account because it’s not hidden.

    Aside from having an interesting location for the home folder, your hidden administrator account is identical in function to any other administrative account.

  • + Share This
  • 🔖 Save To Your Account