Welcome to the Network Home Redirector website for Mac OS X Server (10.3 - 10.5). While network-based home directories provide many benefits, they also bring some unwanted headaches. These headaches usually come in the form of Microsoft Office User Data folder issues, as well as AFP performance issues when dealing with thousands, sometimes millions of cache files. If you would like to redirect some of that traffic to the local machine, instead of taxing your network and your AFP servers, NHR might be for you. Download the DMG file and choose the appropriate package installer(s) for your environment. That's it. The installer will install the scripts, set up the redirection and set a login and logout hook so that the scripts will run at every login and logout. All local users, including mobile accounts and portable home directories, will bypass the scripts and hooks. Please carefully read the README (below) and test before deploying.
NEW IN VERSION 2.1!
I have added in all of my packages, to take one or more of the packages that I have created, and install them on top of each other. By default, only one script can be associated with a login hook, but by installing any of my packages, you will be able to install multiple login scripts that will all run at login. So, if you want to use several of my packages, you don't have to try and figure out how to get them all inside of one script - simply install any of the installer packages and that package will get added to any of your existing login/logout hooks (and if you don't have any set, it will set up the current package up as a login hook).
NHR - The purpose of this package installer is to provide you with an easy way to distribute a script(s) that will redirect several files and folders from a network home user's home on the server to the local machine. These files and folders can include Microsoft User Data, AppleWorks User Data, Caches, Fonts, Movies, Music and Pictures folders. By redirecting these folders to the local machine, it can help with server performance, since these files and folders will "live" on the local machine and not on the server.
The package installer will install clean.sh (or cleanbasic.sh or cleanmm.sh - depending on the package that you install) and cleanup.sh in the /etc/hooks folder of the local machine. It will then set a login and logout hook on the local machine so that clean.sh (or cleanbasic.sh or cleanmm.sh - depending on the package that you install) will run at each login and cleanup.sh at each logout. All local accounts (including mobile accounts and portable home directories) will bypass these scripts, and only users with network homes will be affected.
NHRBasic.pkg simply redirects the network user's Caches and Fonts folders to the local machine (Caches into /tmp and Fonts to /Library/Fonts). NHR.pkg redirects the network user's Caches and Fonts folders, along with the user's Microsoft User Data and AppleWorks User Data folders. One thing that is important for this installer to work correctly, is to make sure the local admin user (the first account set up on the local machine - with UID 501), has launched all of the Office applications - Word, Excel and PowerPoint and AppleWorks. NHRMM.pkg will do everything that NHR.pkg does, and will also redirect the network user's Movies, Music and Pictures folders to the local machine (in /Users/Shared/). And NHRUninstall.pkg is a package that will delete all scripts from any of the package installs above and the login and logout hooks.
To summarize, these files are installed (the installer checks to see if another package installer by me has been installed, and if so, only installs the new script, otherwise it will install):
/etc/login.hook
/etc/logout.hook
/etc/hooks/*.hook (depending on the package installed)
/etc/hooks/masterlogin.hook
/etc/hooks/masterlogout.hook
Sets a login and logout hook (defaults write /private/var/root/Library/Preferences/com.apple.loginwindow LoginHook /etc/login.hook and logout.hook)
Note: Currently, the network user needs to have a login shell defined in Workgroup Manager for the scripts to function properly (If it is set to None, the scripts won't be able to run properly). Also, I have only tested the Microsoft Office redirection with Office v.2004 - earlier versions have not been tested and might not work as expected. Also, if Entourage is used, do not run the redirection for Office, as Entourage will not work correctly.
Update: There appears to be an issue with Office redirection if there is a folder missing at the root of your network mount on the server. The user will be able to successfully save a new document once, and after that, they will get error messages that they don't have permission to save the file to the destination. The answer to this was found on http://macosxhints.com:
http://www.macosxhints.com/article.php?story=20051122213207398
The fault occurs unless a folder called .TemporaryItems has been created at the root level of any mounted volume containing the saved file; so if the user's home directory is contained in an AFP share called Homes, then there has to be a directory called .TemporaryItems in the Homes folder on the server. If the home directory is on another local volume called UserData, there has to be a directory called .TemporaryItems at the root of that volume.
Since .TemporaryItems is a dot file, it will not be visible in the Finder. When the application is able to create this .TemporaryItems directory, it is world writable and sticky. For improved security, as long as all users are in a common group like "staff," then the folder can be restricted to writing by the group instead.
$ cd /path/to/volume/or/sharepoint
$ sudo mkdir .TemporaryItems
$ chgrp staff .TemporaryItems
$ chmod 1770 .TemporaryItems
Disclaimer: Use these packages and scripts at your own risk. Although I have complete confidence in the NHR scripts, you are reminded that use of these scripts are at your own risk without any warranty. In no event shall I be liable for any damage that these scripts might cause. Test these scripts out extensively before mass deploying it to your machines.
If you have questions or comments, please send them to jochsner1@mac.com
Special thanks to Steve Hayman, Mike Bombich and Corey Carson for helping with this project!!