Migrating user profiles permissions

bentoms
Release Candidate Programs Tester

Hi guys,

When migrating user profiles from mac to mac or off a mac, what's your workflow?

I do not have 2nd partitions, & as Migration Assistant doesn't seem to see AD Mobile accounts... I do the following;

  1. Connect External drive.
  2. Copy user profile to external drive.
  3. Reimage mac or image new mac.
  4. Login to the mac as the user (AD binds are part of imaging process).
  5. Login as admin, copy the contents of the old profile into the newly created profile (replacing the files & folders).
  6. Use batchmod to propagate permissions from root of newly created user folder through all the copied files.

It works, but wondered if you guys did anything differently? If not I'm looking at possible creating a AppleScript app for the above.

Regards,

Ben.

4 REPLIES 4

Not applicable

This should help. It's what we used for our refresh. You'll need to adjust the group name to match your environment.

I used tar because I knew it could be trusted to replicate things exactly. I had tried cp, and found that some data wasn't quite right (I forget what it missed, but I suspect it was metadata). This was before I knew about ditto, pax, or cpio.

#!/bin/sh

src=${1}
dst=${2}

if [ -z "${src}" -o -z "${dst}" ]
then
echo "Usage: sudo ${0} SOURCE DEST"
exit 2
fi

s_base=$(basename "${src}")
d_base=$(basename "${dst}")
s_dir=$(dirname "${src}")
d_dir=$(dirname "${dst}")

if [ "$(whoami)" != "root" ]
then
echo "Error: You must be root. Try using sudo."
exit 1
fi

if [ ! -d "${dst}" ]
then
echo "Error: ${d_base} must log in at least once first."
exit 3
fi

/bin/mv -i "${dst}" "${dst}.old"

/bin/mkdir "${dst}"

/usr/bin/tar -C "${s_dir}" -c "${s_base}" |
/usr/bin/tar -C "${dst}" -xpv --strip-components 1

echo "Fixing permissions"
/usr/sbin/chown -R "${d_base}" "${dst}"
/usr/bin/chgrp -R "Domain Users" "${dst}"

tlarkin
Honored Contributor

If you look in the Deploy Studio script kit, there are plenty of user data migration scripts. They could easily be migrated to Casper.

bentoms
Release Candidate Programs Tester

Thanks.

So my methodology wasn't wrong.

I might still try & GUI it with the option to "login" as the user from within the all the select source & dest. Should be pretty easy.

The only problem I've had is reading what users & groups have what permissions. Man page anyone?

Regards,

Ben.

Not applicable

If the Mac you're running on is bound to AD, chown will be able to set the ownership correctly. I could probably put more logic in to autodetect the right group, but I have insufficient motivation to do so, for now.

I do want to mention that you should never use non-HFS+ filesystems to store any significant Mac data, without archiving it first. Loss of metadata can be extremely frustrating, and can bite you even years later, when the original data is long gone.