Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: run htpasswd as unix command in the program

by oakbox (Chaplain)
on Apr 14, 2004 at 06:16 UTC ( #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
Node Status?
node history
Node Type: note [id://344938]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2020-03-31 02:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    To "Disagree to disagree" means to:









    Results (179 votes). Check out past polls.

    Notices?