passwd & groups adoption through rails

Is there a good way anyone can think of doing this:

I want to read in the /etc/passwd & /etc/shadow and /etc/group file and prune all the accounts that are not necessary then use them as the login and password for my website. It will be an internal application that controls an automated install server.