vivekvp has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl + use Unix::PasswdFile; + + ($sec,$min,$hour,$dy)=localtime(time); + $stamp=".".$hour.$min.$sec; + + $pw = new Unix::PasswdFile, "/etc/passwd"; $pw->user("joeblow", $pw->maxuid + 1, 10,"Joe Blow", "/export/home/ +joeblow", "/bin/ksh"); + + $pw->delete("deadguy"); + $pw->passwd("johndoe", $pw->encpass("newpass")); + foreach $user ($pw->users) { + print "Username: $user, Full Name: ", $pw->gecos($user), "\n"; + } + $pw->commit(backup => 'bak'); + $pw->commit(backup=>$stamp); + + undef $pw;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passwdfile.pm help?
by Ferret (Scribe) on Aug 08, 2002 at 17:58 UTC | |
by vivekvp (Acolyte) on Aug 08, 2002 at 19:45 UTC | |
by Ferret (Scribe) on Aug 08, 2002 at 21:41 UTC | |
by vivekvp (Acolyte) on Aug 09, 2002 at 13:57 UTC |