Password file migration help

Mel fbsd.questions at rachie.is-a-geek.net
Thu Jan 31 14:48:05 PST 2008


On Wednesday 30 January 2008 20:26:20 Vince wrote:
> 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?
>
> hmm very roughly just a
> for uid in $(jot 2001 3000); do grep $uid /etc/master.passwd >
> accountstokeep.txt ; done

That's a bit loose, and forgot a dash. The following should really only get 
the uid's (not the gids, parts of a password, comments and what not):
for uid in $(jot - 2001 3000); do \
	grep -E "^[^:]+:[^:]+:$uid:" /etc/master.passwd;
done

This doesn't migrate home dirs, but using the above and piping to:
	cut -f 9 -d ':'
should give you a list of home dirs to work with.
-- 
Mel


More information about the freebsd-questions mailing list