Using a script to retrieve user and group profiles for each computer

Alternatively, you can write a script to retrieve all of the /etc/passwd and /etc/group files in the target set of computers. For example, to create a hostname.passwd and file for each computer in a target set of computers, you might use code similar to the following:

for name in `cat hostname.txt`; \
do scp $name:/etc/passwd $name.passwd; \
scp $name:/etc/group $; \ 

This sample script includes the computer host name in the file name, so that you can determine which user and group definitions came from which computer. If you use a script to collect user and group information, copy all of the files generated by the script to a common location for analysis.