[afnog] Solaris to FreeBSD Migration

Brian Candler B.Candler at pobox.com
Tue Jul 4 15:02:48 EAT 2006


On Tue, Jul 04, 2006 at 10:46:44AM +0100, NJIE EFOME Paul wrote:
> Hi Joe thanks for the help. It worked ok but is there not a script I can the
> use to add all the user from the etc password file or shadow file. Thks in
> advance.

Once you've reformatted the data into the right format, you can just add it
to the end of /etc/master.passwd. For example, use 'vipw' to open the
password file, and then insert the new lines at the end. vipw takes care of
locking the password file and rebuilding the other files which are generated
from it (i.e. /etc/pwd.db and friends)

Alternatively, you can join the two bits and install it directly:

  # cat /etc/master.passwd yourstuff >/tmp/newpasswd
  # cat /tmp/newpasswd    # to check it looks OK
  # pwd_mkdb -p /tmp/newpasswd
  # rm /tmp/newpasswd

pwd_mkdb takes care of installing the new file and generating the derived
files. However while you're doing this, there's a window where any other
changes made to the password file will be lost (e.g. if a user logs in and
changes their password some time between the first and third lines of the
above script)

Brian.



More information about the afnog mailing list