htpasswd Replacement: Perl Script To Create Password Using crypt()
Posted in Web Server
Webserver such as Nginx / Lighttpd accepets passwords using encoded method i.e. function crypt(3) is needs. You can create the password file with the htpasswd program from Apache. Sometime Apache is not installed use the following perl script to create password.
How do I use crypt.pl?
Download script
Set permissions:
chmod +x crypt.pl
./crypt.pl mySecrete
Sample Output:
$1$mySecret$TQgDKW6xpDmEUyxm5ZDxv/
Now you can create htpasswd file for lighttpd or nginx:
user:$1$mySecret$TQgDKW6xpDmEUyxm5ZDxv/
Perl script to replace htpasswd
#!/usr/bin/perl use strict; my $passWord=$ARGV[0]; print crypt($passWord,$passWord)."\n";
Download - Email this to a friend - Printable version
Is your site working? Monitor Your Web Site 24/7. Get SMS alerts on server downtime! Free 30-day trial including 20 SMS!
Related Other Helpful Shell Scripts:
- Shell script to read a character (upper or lower), digit, special symbol and display message according to the character entered
- Shell Script To Encrypt Any Text File
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: apache, crypt, htpasswd program, lighttpd, mysecret, nginx, password file, passwords, perl script, pl ~ Last updated on: October 6, 2008

