delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:

Can I do this from with a perl script (e.g. I want to create an admin interface).


I'm running perl on a unix server, and i want to use htpasswd to protect some directories. Can I do this from with a perl script (e.g. I want to create an admin interface).

TOP

Thanks, didn't mean to cross post.
I've already created a number of admin interfaces, and used htaccess before. The interfaces set up new accounts for various services on a server. Each account needs it's own passwd and username. At the moment these have to be created manually via telnet. I just wanted to make the whole process dummy proof.

TOP

Thanks, I'm not asking for ne1 to write my scripts for me, I just thought that I would ask for a little advice.
I don't need to be lectured to in a patronising manner in the process.

TOP

OK, I am asking something specific:
1) I know that I can get away with a system() call to htpasswd command to add another user, but I think this is not that elegant. I am looking for some way to crypt the password so it would be stored in a .htpasswd file. Any suggestions or tutorials??
2) Is the split() function a good way to search for a username in the .htpasswd file?? Something like:
foreach $line (<FILE> ){
   ($user, $pass) = split(/:/,$line);
   if ($user == $q->param("username")){
      $found=1;
      last;
   }else{
      $found = 0;
   }
}
Hoping for an answer...  

TOP

abstract:

Can I do this from with a perl script (e.g. I want to create an admin interface).


Just a few questions:
1) Why are you using $username to retrieve the salt characters??? Is this the username the suer submited to the script, or the one that is extracted from the .htpasswd file??
2) Thanks for the tips, shortened the code a bit and showed me some cool coding...   But I a mglad I was on theright track at least...

TOP

Yes, I know about salt cahracters, and that the standard DES encryption scheme starts with two random characters. What got me confused, was that freebsd used the first 2 characters out of the username. But just now I figured that it was done probably because the username is "there" i.e. it is handy, and Apache doesn't care as long as the passwords are encrypted as they should be.
Am I on the right track here???  

TOP

Thanks a million guys!!! I havent't tried it yet (still caught up in some ohter wok, not computer related) but I will try it as soon as I can muster some serious time.
Thanks again!! No beating this forum!  



Can I do this from with a perl script (e.g. I want to create an admin interface).

TOP

Back Forum