Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Dec 2006 10:19:13 -0800
From:      David Newman <dnewman@networktest.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: replicating /etc/passwd on a failover machine
Message-ID:  <45897EA1.1010800@networktest.com>
In-Reply-To: <200612201106.03880.kirk@strauser.com>
References:  <458964AB.2080400@edpausa.com> <200612201106.03880.kirk@strauser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/20/06 9:06 AM, Kirk Strauser wrote:
> On Wednesday 20 December 2006 10:28 am, stas khromoy wrote:
> 
>> i doubt that just copying over /etc/passwd and master.passwd will work .
> 
> You'd also need to pick up /etc/{s,}pwd.db - the compiled versions of those 
> files.

Dunno if this works on FreeBSD, but with OpenBSD I have successfully
copied accounts between machines like this:

1. Run vipw on both machines and copy and paste the user accounts. vipw
works like vi.

Note that this step assumes the same environment exists on the source
and destination machines. If, for example, a user's shell is bash on the
source machine, then /usr/local/bin/bash must exist on the destination
box as well.

2. Copy and paste the relevant user groups from /etc/group. If users are
members of other groups (e.g., wheel), ensure that info matches as well.

3. On the source machine, run:

rsync -avz /home/<username>/ destination_machine:/home

This will move username's home directory over, preserving ownership and
permissions for all directories and files. Note the trailing slash on
the source directory.

This probably needs to be run as root, which means that at least
temporarily you need to go into the destination machine's
/etc/ssh/sshd_config and add this line:

PermitRootLogin yes

and then restart sshd like this:

kill -HUP `cat /var/run/sshd.pid`

If you don't normally want ssh access for root, be sure to undo that
change in sshd_config once you're done.

dn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFiX6hyPxGVjntI4IRAs6PAKCk1YP2cKYWx70NxU5ZiOQyFtgHLACffFIH
27pgxgkQ+CYOaBJWD3n/2MQ=
=nMBm
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45897EA1.1010800>