X

How-To: Customize new user account templates

A brief how-to on creating new and customized account templates in the system, which can be used for guest accounts and permanent accounts.

Topher Kessler MacFixIt Editor
Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.
Topher Kessler
3 min read

User accounts by default are empty and contain the default system settings such as the starry space background image, the dock at the bottom with iLife and Safari in it, and an accounts folder with a template website and some PDF information documents. While in most cases this is a good starting point, in certain situations people create accounts quite frequently and would like the default desktop to be different, either for something as simple as having the background reflect a company's name, or to ensure specific applications are configured properly on new accounts.

In addition to being useful for new accounts, customized templates can be useful for guest accounts, which are reverted back to the template's settings upon logout. Having a template will prevent the need to set up applications each time a guest logs in.

Procedure:

  1. Back up the default user templates

    The first thing to do is back up the current user templates. The templates are stored for each supported language in the /System/Library/User Templates/ folder; however, this folder is only accessible by the system. While you can add permissions for an administrator account to access this folder, the easiest way to back it up is to archive it using the terminal, so open the terminal and enter the following commands sequentially:

    cd /System/Library/
    sudo tar czpf UserTemplates.tar.gz User\ Template

    This will create a file called "UserTemplates.tar.gz" in the /System/Library/ folder that contains the original templates and preserving their respective permissions. To restore the original user templates at any point, open a new terminal session and enter the following commands:

    cd /System/Library/
    sudo rm -Rf /System/Library/User\ Template/
    sudo tar xzpf UserTemplates.tar.gz

  2. Create and configure a new account

    Create a temporary account, which you will need to name something besides "Guest" (ie, "Guest2"). Then log into that account and set it up accordingly by adding any documents, manuals, pictures, backgrounds, dock positions, specific application settings, login items, etc., as you would like to have for your template.

  3. Copy the account to the templates folder

    From within the new account, open the terminal and first delete the existing template with the following command.

    sudo rm -R /System/Library/User\ Template/English.lproj/*

    Then copy the new account to the deleted user template with the following command:

    sudo cp -Rf ~/ /System/Library/User\ Template/English.lproj/

  4. Alter Permissions.

    Once the account has been copied to the template location, you need to change the permissions on the new template. Go to the /System/Library/ folder and get information on the "User Template" folder. There should only be the "system" and "everyone" users listed, with only the system having access to the folder. Click the lock and authenticate, and then add your user to the list. Keeping this information window active, open the "User Template" folder and get information on the "English.lproj" folder. Authenticate again if necessary, and then use the gear menu to "Apply to enclosed items" for the permissions. Then go to the "User Template" information window and remove your username from the permissions list.

  5. Further alter permissions

    The method we used in the last step to change permissions also altered the default permissions of the "Sites" and "Public" folder. While reverting these changes is optional, you can get these folders back to their default permissions by running the following set of commands:

    sudo chmod -R o+w /System/Library/User\ Template/English.lproj/Sites
    sudo chmod -R o+w /System/Library/User\ Template/English.lproj/Pubic
    sudo chmod o-w /System/Library/User\ Template/English.lproj/Drop\ Box

  6. Log out and remove new account

    After you have changed the permissions accordingly, log out of the new account and go back to your normal administrator account. From here you can remove the new account you created for making your template, after which you are all set to use your new account template.

NOTE: In these commands I use the English localization; however, if you would like to create the template for another localization, substitute any one of the following for "English.lproj" in the commands above: Dutch.lproj, French.lproj, German.lproj, Italian.lproj, Japanese.lproj, Spanish.lproj, da.lproj, fi.lproj, ko.lproj, no.lproj, pl.lproj, pt.lproj, pt_PT.lproj, ru.lproj, sv.lproj, zh_CN.lproj, zh_TW.lproj.