[PLUG] Moving users

Stafford A. Rau srau at rauhaus.org
Fri Jun 7 15:41:28 UTC 2002


* Andrew Puch <aapuch at attbi.com> [020606 18:02]:
> On Thu, 2002-06-06 at 17:47, launi wrote:
> > I want to rebuild one of my servers.  I host email on it and want to move 
> > the user accounts and directories onto another server.  Isd there a HowTo 
> > that lists the steps to do this using TAR?
> 
> 
> 
> this should do the trick, from the Book of TOR, chaper 19.17  
> cd /home
> tar cf = . | cat | (cd /mnt/root/home; tar xbf xbf 1 -)
> cd /var/spool/mail
> tar cf = . | cat | (cd /mnt/root/var/spool/mail; tar xbf xbf 1 -)

I'm not familiar with the "=" notation, but there's no need for the cat,
and this example only works if you're moving it to a local file system
or to one that's been NFS (or AFS or samba or whatever) mounted.

To move directories to a new host, you could do something like the
following:

cd /home
tar -cf - usera userb userc useretc | (ssh newhost "cd /home; tar -xvf -")

If you are using GNUtar at both ends, there are a bazillion options that
make this even nicer - the "-C directory" option will tar or untar
relative to "directory", so you could eliminate that "cd /home;" above.

Be sure the same user accounts and uids exist on the new machine before
you do this.

--Stafford




More information about the PLUG mailing list