shell script to find unowned users and groups

Hello,

I am new to Unix and shell scripting. I am trying to find unowned files and groups on my servers. I know, i could use the below command to find it on individual server.
#find / -nouser -o -nogroup -print

But I was wondering, if someone could help with a shell script so that I can find it on a bunch of servers from one cental location.

Thanks.

Do you have or know what ssh is? You can use that to execute remote commands.
Let's say you have three servers node1 node2 node3, and you are on node1

echo "find / -nouser -o -nogroup -print > ./t.lis" >  my.sh

for node in node2 node3
do
     scp my.sh me@${node}
     ssh me@${node} "chmod +x ./my.sh"
     ssh me@${node} "./my.sh"
     scp me@${node}:t.lis  ${node}.lis
done

I did not test this - but you get the idea. You will have to set up ssh keys on each machine.

Actually...could you re-write this script for the following scenario. Host system=sysctrl and on this machine there is a directory /sys/cfg/inventory which has all the servers i need to gather the information.

Yes, I know about setting up the ssh keys...in the meanwhile if you could send me a script to use the servers from the directory mentioned above, it will be highly appreciated.

Thanks again.