Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Apr 2002 11:49:20 +0200
From:      "Patrick O'Reilly" <bsd@perimeter.co.za>
To:        "Erik Funkenbusch" <erikf@visi.com>, <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Moving user information
Message-ID:  <017401c1e13e$27b94600$b50d030a@PATRICK>
References:  <00ab01c1e104$dd8fc470$838ecd40@hedgehog>

next in thread | previous in thread | raw e-mail | index | archive | help
----- Original Message -----
From: "Erik Funkenbusch" <erikf@visi.com>


> Can anyone outline the steps I should take to move all users and user
data
> to another server?
>
> I don't want to recreate the users, so i'm looking for someway to
export the
> user data and login information to another server.  What files are
necessary
> to copy, and is it possible to merge two password databases?

Off the top of my head:
1) Have someone else double-check and confirm that I have not said
something very stupid here!

2) Make sure you do not have duplicated user names OR user IDs on the
two servers.  The duplication of system accounts, like root, named,
smmsp, etc will be handled in step 4.

3) If all user files are in the users' home directory trees, then tar it
all up and untar it on the new server.
# cd /home
# tar czf /tmp/home.tgz .
Now move the /tmp/home.tgz file to the new server, and on that new
server do:
# cd /home
# tar xzf /tmp/home.tgz

4) copy the two /etc/master.passwd files from the two servers to the new
server as /tmp/master.old and /tmp/master.new.  Now, on the new server:
# cd /tmp
# cat master.old master.new > master.passwd
# sort -o master.passwd master.passwd
# vi master.passwd ( check for duplicated names and remove them - BE
CAREFULL not to damage field 2 - that's the encrypted password)
# sort -n -t: +2 -3 -o master.passwd master.passwd
# vi master.passwd ( check for duplicated user ids [column 3] and remove
them - BE CAREFULL not to damage field 2 - that's the encrypted
password.  Also, find the "root" account and make sure it is the first
account listed, and move the line "# $FreeBSD: src/etc/master.passwd..."
to the very top of the file [remove the older version's comment line])

5) make a backup copy of /etc/master.passwd
# cp /etc/master.passwd /etc/master.passwd.backup
6) Install the new Password Database:
# pwd_mkdb /tmp/master.passwd ( this will install the master.passwd file
to /etc, and rebuild the databases )

7) Test a user login while holding thumbs very firmly ( I'd love to see
how you type while holding thumbs :)

8) If there is a problem you can restore your backup like so:
# pwd_mkdb /etc/master.passwd.backup

As I said in (1), please verify this with someone else as I've thrown
these instructions together rather quickly.

Regards,
Patrick O'Reilly.
    ___        _            __
   / _ )__ __ (_)_ __ ___ _/ /____ __
  / __/ -_) _) /  ~  ) -_), ,-/ -_) _)
 /_/  \__/_//_/_/~/_/\__/ \__/\__/_/
    http://www.perimeter.co.za




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?017401c1e13e$27b94600$b50d030a>