Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: run htpasswd as unix command in the program

by oakbox (Chaplain)
on Apr 14, 2004 at 06:16 UTC ( [id://344938]=note: print w/replies, xml ) Need Help??


in reply to run htpasswd as unix command in the program

Umm. I usually skip right over using the htpasswd program from apache and just write the file directly from Perl.

my $PASSFILE="/pathto/file/.htpasswd"; open(WRT,">$PASSFILE"); my $id_password; # this is where I pull the list of id's # and passwords from a database or file, # then populate $id_password->{id}=pass; $id_password->{'richard'} = "mypass"; foreach my $id (keys %{$id_password}){ my $pass = $id_password->{$id}; my $pass2 = crypt($pass, "Ce"); print WRT "$id:$pass2\n"; } close(WRT);
You can use other two letter combinations in the seed part of that crypt statement. "Ce" or "xV" or whatever.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://344938]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found