[K12OSN] Re: Move users and home from existing server to new LDAP server (Jim Kronebusch)

Matt Oquist moquist-k12osn at majen.net
Thu Feb 10 15:23:32 UTC 2005


> From: "Jim Kronebusch" <jim at winonacotter.org>
> > I've actually done this....what I did was create my user accounts on 
> > my Samba/LDAP server.....then I moved the homedirs....then I reran 
> > the user script to fix permissions on the folders.  The usernames 
> > must be exactly the same though.

I think Dave might be referring here to his own users script;
smbldap-useradd-bulk doesn't fix permissions or ownership; it will
print any errors it finds in ownership of the top-level /home/<user>
directories.

> So you are saying that as long as the usernames I import into the new LDAP 
> server match the usernames of the current server, exactly, I could just copy 
> the current /home to the new /home and rerun the smbldap-installer and that 
> will automatically assign proper privileges to the folders?  Cool!  

Wouldn't you really want to simply export your current database and
import the data into your new db?

$ slapcat -l out
$ slapadd -l out

Thought judging by the slapcat man-page, you're supposed to somehow
re-order the slapcat output before importing it.  Too bad the man-page
doesn't explain anything more about that...

Also, note that slapd shouldn't be running when you do the export or
import.  I wouldn't worry about it while you're testing, but once
you do the production user migration, I would shut slapd down on both
systems first.

> What do you recommend as the best way to move the folders from the 
> existing /home to the new one?  I was thinking tar from past suggestions I 
> have seen.  What would be the proper syntax to tar /home?

I recommend either tar or rsync.

On a single machine (possibly with an NFS mount one place or the
other):

$ cd /mnt/oldhome/
$ tar czvf /root/home.tgz ./
$ cd /newhome/
$ tar xzvf /root/home.tgz

or

$ rsync -avu /mnt/oldhome/ /newhome/

The ending slashes above are important.  The following is NOT what you
want because it will create a directory called "oldhome" inside
"newhome":
$ rsync -avu /mnt/oldhome /newhome/

Or, if you want to do this over the network (and without using NFS):
$ cd /mnt/oldhome
$ tar czf - ./ | ssh root at newldapserver "cd /home; tar xzvf -"

or

$ rsync -avuessh /mnt/oldhome/ root at newldapserver:/home/

On a semi-related note, see
http://majen.net/docs/linux-clone-howto.txt.  It has more examples of
how to use 'tar' and 'rsync' to copy things hither and thither.

> I have not ran the bulk add script yet, what is the proper file format for 
> this?  Or is this specified in a readme inside the tar.gz file?  I suppose I 
> should download it and check out huh?

Heh - yes, it's all documented in there.

> The only catch I could see here are service specific users like the postfix 
> user and so on.  I should probably export users from the current server to 
> be sure they are included as well.  Running the smbldap-installer shouldn't 
> affect these users, right?

I wouldn't touch system users.  Let the new server create them itself.
Nope, the smbldap-installer won't touch these users.

Good luck!

--matt




More information about the K12OSN mailing list