[NBLUG/talk] Copying Linux from one box to another

Eric Eisenhart eric at nblug.org
Thu Mar 3 08:14:33 PST 2005


On Thu, Mar 03, 2005 at 07:18:48AM -0800, Todd Cary wrote:
> I have one box running RH 9.0 and I want to copy /home to another box 
> running a fresh copy of Fedora 3 (with necessary applications installed 
> e.g. Interbase, PHP, MySQL).  Using "scp", what is the best way to do 
> this so all Ownerships and PW's are maintained?

Well....

A) You need to get accounts moved over, you can:
   1) edit /etc/passwd and /etc/shadow on both systems.  Copy info for
      users accounts over to the new system.
   or
   2) Look in /etc/passwd and /etc/shadow on the old system.  In
      /etc/passwd, you'll see stuff like this:
      eric:x:500:500:Eric Eisenhart:/home/eric:/bin/bash
      and in /etc/shadow you'll see lines like this:
      eric:$1$abcdefghijklmnopqrstuvwxyz01234:12831:0:99999:7:::
      (it's possible that the stuff between the first and second colon in
      /etc/shadow will be shorter and look different...  and it won't be
      abc...)
      So, using that as an example, you'd run a command kind of like:
      useradd -c "Eric Eisenhart" -d /home/eric -M -p '$1$abc[etc...]' eric
      (I'd just ignore the /bin/bash, and the various numbers for this...)

    Now, whether you did #1 or #2, you should have all the accounts on
    the new system that you care about migrated over.  the numeric ids might
    be different, but that's okay.

B) Then, to copy everything, something like (as root on the old system):
   "rsync -e ssh -avP /home newsystem:/home"
    You could use "scp -pr /home newsystem:/home", but that might not get
    users set correctly on files.  Or you could use this good old-fashioned
    technique:
    "cd /home;tar cpf - . | ssh root at newsys tar -C /home --same-owner xpvf -"
    (but of the three, rsync is probably my favorite...)
-- 
Eric Eisenhart
NBLUG Co-Founder, Scribe and InstallFest Coordinator
The North Bay Linux Users Group -- http://nblug.org/
eric at nblug.org, IRC: Freiheit at fn AIM: falschfreiheit



More information about the talk mailing list