Synchronize the user folder between Macs via FileVault
Jun 16, '06 07:30:04AM
Contributed by: veloso
I recently bought a MacBook, and have run into the same issue that everyone who owns a desktop and a laptop has: how do you keep the machines in sync? I found out that it's pretty easy, thanks to FileVault. When you enable FileVault, the system creates an encrypted disk image of your user folder, which is automatically mounts when you log in. You can copy this disk image from machine to machine, which transfers your entire user folder in one blow.
There are some setup gotchas, though:
- Your user name and UID has to be the same on both computers. My UID on my iMac is 503 (lots of users on the box), while my MacBook UID is 501. I created a two fake users on the MacBook to bump the UID number up to a matching value (they start at 501, and each user created increments the next uid).
- You have to turn FileVault on for the user on both machines. FileVault takes a bit of time to do its stuff. Note that you should move anything you don't want to transfer out of your home directory, like your iTunes music library, iPhoto library, movies, etc. You can keep them there, but your transfer times will go way up.
- You need to be able to log in as another user on both machines. This is because you shouldn't copy your FileVault image if you're using it.
- For best results, you should enable ssh's auto-login via the authorized_keys2 hints. Note that you'll have to add the key twice, once when your user is logged in, and once when your user is logged out. Mac OS X doesn't mount the disk image if you're only logged in via ssh.
- For best results, keep everything that isn't in your user folder synchronized (or at least mostly the same).
After everything is set up (whew), the basic idea is simple: log in as another user, and copy the disk image from one machine to another. Then log out and log in as yourself. You need to log in as the other user so Mac OS doesn't mount it.
You can use this script to automate the process somewhat. You need to put a copy on each machine, then adjust the REMOTE_HOST and LOCAL_HOST variables to the remote and local machines, respectively.
[robg adds: I haven't tested this one.]
Comments (21)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060614151657922