in reply to Re^2: stat & uid
in thread stat & uid

tc1364, i'd advise you to use the function mentioned by davidrw. my solution will work, but it's ugly, slow and insecure in comparison. sorry about that...

Replies are listed 'Best First'.
Re^4: stat & uid
by Tanktalus (Canon) on Jul 13, 2005 at 22:17 UTC

    Let me tell you from experience - looking at /etc/passwd is badness. There are so many ways that someone may not be using /etc/password (NIS/NIS+, PAM, LDAP, ...) that ... well, just don't. By using the getpw* functions, you tap into the same C runtime library that the OS uses to validate logins. Which means you'll get the value as used on the system, and not some random value.

    It's just a good habit to get into. And, besides, File::stat and User::pwent are way too easy to use relative to grepping and spliting the /etc/passwd file. :-)