Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Migrate a Local User Account to a Network Account Shell Script

http://support.apple.com/kb/HT5338?viewlocale=en_US&locale=en_US


If you are looking for an easy way to migrate local users to network users without losing data, then try this script.

Follow steps 1-10 in the support link above before running this script.


1) Open /Applications/Utilities/Terminal.App


2) Type vi myscriptname.sh


3) type "i" to edit the document


4) Copy and paste the following text in the terminal window


#!/bin/bash

echo "Go to http://support.apple.com/kb/HT5338?viewlocale=en_US&locale=en_US"

echo "Complete steps 1-10 before continuing"

echo -n "Enter 'USER' and press enter:"

read USER

echo -n "Enter 'SERVER' and press enter:"

read SERVER

sudo scp -Epr /Users/$USER root@$SERVER:/Users/

sudo mv -f /Users/$USER /Users/$USER.old

ssh root@$SERVER sudo chown -R $USER:staff /Users/$USER


5) hit (ESC) then colon : and type wq! and hit return to save the document


6) In Terminal type: chmod +x myscriptname.sh


7) in Finder, Right Click or Control+Click myscriptname.sh and select open with


8) Select "Show All Applications" and Navigate to /Applications/Utilities/terminal.App


9) in Finder, Right Click or Control+Click myscriptname.sh and select get info / Open with and click "Change All" to open all .sh files in Terminal


10) Double Click myscriptname.sh


11) For USER enter the name of the network account


12) For SERVER enter your server name (server.example.com)


13) Enter the Admin Pass for the Local Machine, Then the Server, Then the server again


14) The user folder will be renamed to user.old (bob.old)


15) When you login as the network user account OS X Server Will copy your data to the local machine with Portable home directories


16) Once you verify all the info is there you can delete the user.old folder from the /Users/ folder (bob.old)

Posted on Oct 16, 2012 1:48 PM

Reply
Question marked as Best reply

Posted on Jan 27, 2014 1:27 PM

replace sudo scp -epr with sudo rsync -auvth if you do not want to waste space copying hardlinks

2 replies

Migrate a Local User Account to a Network Account Shell Script

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.