Results 1 to 2 of 2
-
20th Apr 2014, 05:48 PM #1
How to generate an .htpasswd file without having Apache tools installed ?
i would like to protect some of my folders on server but i wonder how can i generate .htpasswd file without apache tools installed on my linux server ?
JackWell Reviewed by JackWell on . How to generate an .htpasswd file without having Apache tools installed ? i would like to protect some of my folders on server but i wonder how can i generate .htpasswd file without apache tools installed on my linux server ? Rating: 5
-
20th Apr 2014, 05:54 PM #2
In Linux (and other Posix): given users John, Mary, Jane and Jim and passwords V3Ry, SEcRe7, V3RySEcRe7 and SEcRe7PwD, in order to generate a password file named .htpasswd, you would issue:
printf "John:$(openssl passwd -crypt V3Ry)\n" >> .htpasswd # this example uses crypt encryptionprintf "Mary:$(openssl passwd -apr1 SEcRe7)\n" >> .htpasswd # this example uses apr1 (Apache MD5) encryptionprintf "Jane:$(openssl passwd -1 V3RySEcRe7)\n" >> .htpasswd # this example uses MD5 encryption(PASSWORD="SEcRe7PwD";SALT="$(openssl rand -base64 3)";SHA1=$(printf "$PASSWORD$SALT" | openssl dgst -binary -sha1 | \
sed 's#$#'"$SALT"'#' | base64);printf "Jim:{SSHA}$SHA1\n" >> .htpasswd) # this example uses SSHA encryption- Or, you may use the following crypt.pl Perl script. Simply save it as e.g. crypt.pl and chmod 700 crypt.pl in order to be able to execute it.
#!/usr/bin/perl
use strict;
chomp(my $filename=$ARGV[0]);
chomp(my $username=$ARGV[1]);
chomp(my $password=$ARGV[2]);
if (!$filename || !$username || !$password) {
print "USAGE: ./crypt.pl filename username password\n\n";
} else {
open my $fh, ">>", $filename or die $!;
print $fh $username . ":" . crypt($password, $username) . "\n";
close $fh or die $!;
}- Or, you may use the htpasswd.py python script.
Follow Board Rules & Thread Rules.
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Installed WP is not showing !
By shufol in forum WordpressReplies: 7Last Post: 12th Nov 2012, 03:18 PM -
How Many Browsers Are Installed In Your PC?
By lig}{tning in forum Polling PlazaReplies: 172Last Post: 11th Jan 2012, 06:49 AM -
Apache is not responding, with ruTorrent installed!
By kundurocks in forum Technical Help Desk SupportReplies: 1Last Post: 26th Mar 2011, 08:56 AM -
Set up PHPUploader. But RL is already installed. Help
By fileserve-links in forum Technical Help Desk SupportReplies: 13Last Post: 7th Oct 2010, 03:21 AM -
How To Keep Those Applications Installed?
By mani in forum Technical Help Desk SupportReplies: 6Last Post: 2nd Sep 2010, 09:38 PM
themaCreator - create posts from...
Version 3.22 released. Open older version (or...