Script to Copy User according to UID
- by bradlis7
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.