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

ty

Replies are listed 'Best First'.
Re^3: stat & uid
by socketdave (Curate) on Jul 13, 2005 at 21:45 UTC
    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...

      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. :-)