Re: Password file migration help

2008-01-31 Thread Mel
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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Password file migration help

2008-01-31 Thread Kemian Dang

Sean Murphy 写道:
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?


Thanks
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
"[EMAIL PROTECTED]"

awk -F: '{if($4 > 3000) if($4 < 5000) print $0}' /etc/master.passwd

You should do it as root.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Password file migration help

2008-01-30 Thread Jonathan McKeown
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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Password file migration help

2008-01-30 Thread Vince

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
should extract the accounts from the old server (no error checking 
though so if any other account has a gid in the range 3000 to 5000 it 
will also be caught.


Then in theory
cat accountstokeep.txt >> /etc/master.passwd
followed by
pwd_mkdb -p /etc/master.passwd
should be enough.

Again care should be taken that there are no conflicting accounts 
already in the /etc/master.passwd file.

(a quick
for uid in $(jot 2001 3000); do grep $uid /etc/master.passwd ; done
on the new machine before adding to it should give you a quick check.)

dont forget to ensure shells and home directories are available as needed


Vince


Thanks
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
"[EMAIL PROTECTED]"


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Password file migration help

2008-01-30 Thread Paul A. Procacci

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?


Thanks
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
"[EMAIL PROTECTED]"
Open vi/vim/etc on both machines via `vipw`, and copy 'n' paste.  Repeat 
for the group file in necessary.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Password file migration help

2008-01-30 Thread Sean Murphy
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?


Thanks
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"