Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2008 00:48:27 +0100
From:      Mel <fbsd.questions@rachie.is-a-geek.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: Password file migration help
Message-ID:  <200801310048.28240.fbsd.questions@rachie.is-a-geek.net>
In-Reply-To: <47A0CF5C.6000400@unsane.co.uk>
References:  <47A0CA04.7060100@calarts.edu> <47A0CF5C.6000400@unsane.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801310048.28240.fbsd.questions>