Script to Copy User according to UID

Posted by bradlis7 on Stack Overflow See other posts from Stack Overflow or by bradlis7
Published on 2010-05-07T21:06:03Z Indexed on 2010/05/07 21:08 UTC
Read the original article Hit count: 287

Filed under:
|
|

I'm looking for a way to copy all non-system users from one PC to another. I can get the group and passwd files copied over using this

awk -F":" ' $3 > 499 ' etc/passwd >> /etc/passwd
awk -F":" ' $3 > 499 ' etc/group >> /etc/group

But, how would I go about getting the shadow file copied over since it does not store the UID? Assume that there are over 1000 users, so doing a grep with the usernames, such as egrep '(bob|bill|sarah|sal):' etc/shadow >> /etc/shadow generating the usernames from the awk code above, would be a bit inefficient, but a possible option.

© Stack Overflow or respective owner

Related posts about linux

Related posts about passwd