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

Using htaccess & htpasswd for password protection

by Anonymous Monk
on Jul 10, 2001 at 14:24 UTC ( #95265=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am running PERL on VMS operating system. I have created a .htaccess and .htpasswd file in the directory that contains pages on my intranet site which i would like to be password protected. So when i try to access one of these pages i am propmpted for a password. The .htpasswd file stores usernames and passwords in the form of USERNAME:CRYPTED_PASSWORD. I have written a script in PERL to add a username and password to the .htpasswd file. The script itself works fine and does add a user and password but the crypted password it returns is in BINARY rather than ASCII. I believe the reason for this is that because i am running PERL on VMS the script uses VMS's way of crypting rather than PERL's CRYPT() function. Is there anyway of forcing it to use PERL's CRYPT() function as opposed to VMS's way of crypting? I have no idea how i can correct this problem, please help, any help would be greatly appreciated. Thank you.
  • Comment on Using htaccess & htpasswd for password protection

Replies are listed 'Best First'.
Re: Using htaccess & htpasswd for password protection
by thpfft (Chaplain) on Jul 10, 2001 at 14:58 UTC
Re: Using htaccess & htpasswd for password protection
by gornox_zx (Priest) on Jul 10, 2001 at 22:07 UTC
    The crypt() function in Perl is a variation of a DES (Data Encryption Standard) hash algorithm. This function is similar to the c crypt() function.
    char *crypt(const char *key, const char *salt);
    Perl's crypt() function should work for what you are trying to do. You can't do your own encryption algorithm since it isn't really encryption, it is a hash. If you can't get the perl crypt to work, you can try to snatch the c version from libc source, and use it in your script, it is very portable.
    ~heise2k~

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://95265]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2019-05-25 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (152 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 18:53 UTC) Welcome new users!