• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

.htaccess ?

GregT

Waffles!!
NLC
How do I .htaccess a directory so that only the usernames and password i specify are allowed in ?
 
i dont have access to ssh or telnet. is there any other way to generate this password file ?
 
Originally posted by raz0r
i dont have access to ssh or telnet. is there any other way to generate this password file ?

With perl..

Creating your user file with Perl
Note that, if you are so inclined, you can manage your user file with Perl, or any other language which has a DB-file module, for interfacing with this type of database. This covers a number of popular programming languages.

The following Perl code, for example, will add a user 'rbowen', with password 'mypassword', to your password file:

use DB_File;
tie %database, 'DB_File', "passwords.dat"
or die "Can't initialize database: $!\n";

$username = 'rbowen';
$password = 'mypassword';
@chars=(0..9,'a'..'z');
$salt = '', map { $chars[int rand @chars] } (0..1);

$crypt = crypt($password, $salt);
$database{$username} = $crypt;

untie %database;

As you can imagine, this makes it very simple to write tools to manage the user and password information stored in these files.

Passwords are stored in Unix crypt format, just as they were in the "regular" password files. The 'salt' that is created in the middle there is part of the process, generating a random starting point for that encryption. The technique being used is called a 'tied hash'. The idea is to tie a built-in data structure to the contents of the file, such that when the data structure is changed, the file is automatically modified at the same time.

Just hack it to meet your needs.
 
ok i did that, ran the file after editing it and made the .htaccess file. now the folder asks for my login info and after putting it in refuses it. i opened passwords.dat and its just has

a  Ò @            •n}ã   

then a huge blank space

then raz0rý followed by about 10000 ÿ's

plz help :(

Edit: i fixed by using AuthDBUserFile instead AuthUserFile
 
Last edited:
Originally posted by raz0r
ok i did that, ran the file after editing it and made the .htaccess file. now the folder asks for my login info and after putting it in refuses it. i opened passwords.dat and its just has

a  Ò @            •n}ã   

then a huge blank space

then raz0rý followed by about 10000 ÿ's

plz help :(

Hmm.. Try a search on http://cgi.resourceindex.com/ for something that encrypts passwords. Then you can just ftp the changes in as the password format is easy..

username:password
 
SORRY i tried to help, i will never help you again, seriously since you didnt even say thanks for wasting my time, jesus
 
Originally posted by is0lized
SORRY i tried to help, i will never help you again, seriously since you didnt even say thanks for wasting my time, jesus
i didnt click your link till after i posted. it could prove useful in the future if i ever need it as i only need one user. :devious2: :p
 
you can also use PHP for a HTTP authentification ( same as .htaccess ).
You can use it with a mysql database which includes all the users and passwords.
 
Back
Top