Password file migration help

Jonathan McKeown jonathan+freebsd-questions at hst.org.za
Wed Jan 30 23:26:40 PST 2008


On Wednesday 30 January 2008 21:03, Sean Murphy wrote:
> I have a FreeBSD 5.4 system and would like to migrate users in the
> password file with UIDs 3000 through 5000 to a FreeBSD 6.3 system on a
> running on a separate box.  Is there a way to export just those users?

I'd probably sort /etc/master.passwd and pipe through awk:

sort -t ':' -k3,3n /etc/master.passwd | \
  awk -F ':' '$3 ~ /^3[0-9][0-9][0-9]/, $3 ~ /^5/ { print }'

This will sort /etc/master.passwd numerically on the third field, uid, and
then give you all the lines starting with the first one where the uid is a
3 followed by at least three digits, up to and including the first one after
that where the first digit of the uid is a 5.

If you capture the output you should be able to merge it on the new host.

Jonathan


More information about the freebsd-questions mailing list