Perl has the getpwent function from C. You can use that directly as a perl function if you want. You might need the stat function. Also linux has the pwck tool that identifies some of the problems you describe. It's just as fine to do it the way you're going. /etc/passwd is very parseable as text, another way to do it.
If you run the program as root, your program has all the permissions as root. So if you make a mistake in your programming and accidentally tell perl to wipe out your password file, the OS is not going to stop it from doing that, it is allowed. If your program runs with more limited permissions, the OS will prevent it from doing things it is not allowed to do.
Perl has more to offer in this venture also. You could make your program aggregate the results into an excel spreadsheet, e-mail you the results, fix them right there, etc. To actually fix the results you would probably need more permissions.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|