Thanks, I will see what I can do with this. I did find a htpasswd.pl file
that lets me add single users via the browser. It shows the users created
too, and protects against duplicates. It would be great to get your script
working, since I haven't found anyone to thrilled about adding users one at
time.





----- Original Message -----
From: "Adam Maloney" <adamm at sihope.com>
To: <tclug-list at mn-linux.org>
Sent: Friday, May 02, 2003 8:54 AM
Subject: Re: [TCLUG] htpasswd script


> There may not be one that exists, but it's pretty easy to do I think.
>
> If users.txt is just "username (WHITESPACE) password"
>
> #!/bin/sh
> for USER in `cat users.txt | awk '{ print $1 }'`; do
>   PASSWORD=`grep "^$USER" users.txt | head -1 | awk '{ print $2 }'`
>   /usr/local/apache/bin/htpasswd -b /path/to/.htpasswd $USER $PASSSWORD
> done
>
> Or cat it to this perl script:
>
> #!/usr/bin/perl5
> while (<>) {
>   ($user, $password) = split;
>   system("/usr/local/apache/bin/htpasswd -b
>   /path/to/.htpasswd $user $password)";
> }
>
> If your version of htpasswd can't take a password on the command line, you
> can generate them on the fly with perl, and then add the output to the end
> of the existing .htpasswd file.
>
> #!/usr/bin/perl5
> while (<>) {
>   ($user, $password) = split;
>   $salt = join '',('.','/',0..9,'A'..'Z','a'..'z')[rand 64, rand 64];
>   $encrypted_password = crypt($password, $salt);
>   print "$user:$encrypted_password\n";
> }
>
> I just typed these in - so test first before committing any changes.  No
> guarantees they work!
>
> Adam Maloney
> Perl Monger :)
>
> On Fri, 2 May 2003, Raymond Norton wrote:
>
> > I am setting up an IPCop box basically as squid box using proxy_auth.
> > Is there a script I can drop in the html folder that will let an
> > administrator add web users via a web page, or is there was a way to
> > import a txt file with 200 users and passwords?
> >
> >
> > Raymond
>
>
>
> _______________________________________________
> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
> http://www.mn-linux.org tclug-list at mn-linux.org
> https://mailman.real-time.com/mailman/listinfo/tclug-list
>



_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
http://www.mn-linux.org tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list