If you can't read the passwd file, that may be an indication that you're not supposed to. There's a reason that it's read-only by root: getting a list of valid users for a machine increases the vulnerability to attack by crackers. That having been said, if you show some example code, someone might be able to help you assuming that you're
not trying to crack.
thor
Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come