On Mon, Aug 09, 2010, Keith Roberts wrote:
>On Mon, 9 Aug 2010, Gary Greene wrote:
>
>> To: CentOS list <centos@centos.org>
>> From: Gary Greene <ggre...@minervanetworks.com>
>> Subject: Re: [CentOS] Moving users from Debian-based distro to CentOS
>> 
>> On 8/8/10 10:59 PM, "John R Pierce" <pie...@hogranch.com> wrote:
>>>   On 08/08/10 10:47 PM, Dotan Cohen wrote:
>>>> I have a Debian machine with four users that I plan on migrating to
>>>> CentOS. As per Debian habits the UIDs start with 1000.
>>>>
>>>> Is it enough to reuse the Debian /etc/shadow and /etc/passwd files
>>>> over? Or will I need to configure some other things? I had considered
>>>> just creating four new users starting from UID 500 then chown -R -ing
>>>> the user's home directories, but I find that invasive and possibly
>>>> error prone (maybe there are files that are not owned by them).
>
>what about using the `find` command, and piggy-back 
>the chown command on that?
>
>`pinfo find`
>

I find that it's fairly easy to migrate users from the old system
to the new by creating rsync modules for each user pointing to
the user's $HOME directory, then using rsync to copy everything
to the user's directory to the new system.

This does not require having the uid/gid the same on the two
systems, only that the user and group names be consistent.  Here
are a couple of sample rsyncd.conf entries for this:

[bill_upd]
        uid = bill
        gid = csys
        read only = false
        path = /home/bill
        comment = /home/bill
        use chroot = yes
        # only allow internal network
        hosts allow = 192.168.253.0/24
        hosts deny = *
        list = no

[john_upd]
        uid = john
        gid = users
        read only = false
        path = /home/john
        comment = /home/john
        use chroot = yes
        # only allow internal network
        hosts allow = 192.168.253.0/24
        hosts deny = *
        list = no

Then a fairly simple loop on the source machine can copy/sync
each user's data from the old machine to the new one:

#!/bin/bash
for user in bill john; do
        rsync -varP ~$user/ dstmachine::${user}_upd/
done

The rsync command takes care of the user/group mappings, and is
very efficient.  One can make an initial run to get the bulk of
each user's files to the new machine, then do a final rsync just
before the cut-over adding ``--delete'' to the rsync command to
get rid of any files deleted from the old machine since the
initial run.

We have used this to migrate ISP mail servers with thousands of
user's $HOME directories containing Maildir mail stores with
minimal down time.  In this case, we created all the user
accounts on the new machine so their $HOME directories existed,
then did the rsync copies after switching the DNS for the mail
servers to point to the new machine.  There was a fairly short
period in which users would see only new mail that arrived until
their Maildir folders had been completely copied.  On a machine
with about 8,000 e-mail users, and gigabytes of data, it took a
bit more than an hour to rsync all the user's accounts.

Bill
-- 
INTERNET:   b...@celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186  Skype: jwccsllc (206) 855-5792

"I do not feel obliged to believe that the same God who has endowed us
with sense, reason, and intellect has intended us to forego their use."
    -- Galileo Galilei
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Reply via email to