sleggtools
10-26-2001, 01:19 PM
hello,
I need some help, I am trying to password protect a folder so that nobody on the net can access it without a password.
Appreciate any help
Steve
jucebro
10-26-2001, 01:43 PM
Put the bellow text, with your information, in a file named ".htaccess" in the directory you want protected:
AuthUserFile /home/sites/www.yourdomain.com/web/protected/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
AuthName "Protected Directory"
AuthPAM_Enabled off
<LIMIT GET POST>
require valid-user
</LIMIT>
AuthUserFile needs to equil the path to your protected directory + .htpasswd
After that, telnet into the server, cd to the protected directory and run:
htpasswd -c .htpasswd UserName
you should be prompted for a password after that. Username is the User you want to give access to the protected dir.
To add more users, from the protected directory, run:
htpasswd .htpasswd UserName
Steffen
10-28-2001, 06:04 PM
hi,
here comes a html/php code, your put them in a file and save it as .php (htaccessmaker.php). its absolute easy ... fill the form and see the .htaccess file-code and .htpasswd file-code ... copy them in your files and via ftp on you raq3/4.
<html>
<head>
<title>.htaccess on COBALT RAQs</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="Cache-Control" content="post-check=0, pre-check=0">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="ROBOTS" content="NOINDEX,NOFOLLOW">
</head>
<body bgcolor="#CCCCCC">
<form action="<? echo $PHP_SELF ?>" method="post">
<table border="1" cellspacing="0" cellpadding="1" width="550" bgcolor="#FFFFFF">
<tr><td>area:</td><td>
<input type="text" name="area" maxlength="30">
</td><td nowrap>e.g. Secure Area</td></tr>
<tr><td>your Domain:</td><td>
<input type="text" name="domain" maxlength="50">
</td><td nowrap>e.g.: www.domain.com</td></tr><tr><td>protecting path:*</td><td>
<input type="text" name="pfad" maxlength="30">
</td><td nowrap>e.g.: /data</td></tr>
<tr><td>username:</td><td>
<input type="text" name="username" maxlength="12">
</td><td nowrap>no Special characters</td></tr><tr><td>password:</td><td>
<input type="text" name="passwort" maxlength="12">
</td><td nowrap>no Special characters</td></tr><tr><td colspan="3">*optionally</td></tr>
<tr><td colspan="3" align="right" bgcolor="#000000">
<br><input type="submit" value="Make Data" name="submit">
</td></tr></table><br></form>
<?php
if (isset($submit)) {
if ((empty($area)) || (empty($domain)) || (empty($username)) || (empty($passwort))) {
echo "<b>Error:</b> fill out please all fields!";
exit;
}
echo "<table width=\"550\" border=\"1\" cellspacing=\"0\" cellpadding=\"6\">";
echo "<tr bgcolor=\"#FF0000\"><td><b>Data for the .htpasswd File!</b></td></tr>";
echo "<tr bgcolor=\"#FFFFFF\"><td><font color=\"#000000\"><code>";
echo "$username:".crypt($passwort);
echo "</code></tr></td></table><br>";
echo "<table width=\"550\" border=\"1\" cellspacing=\"0\" cellpadding=\"6\">";
echo "<tr bgcolor=\"#FF0000\"><td><b>Data for the .htaccess File!</b></td></tr>";
echo "<tr bgcolor=\"#FFFFFF\"><td><font color=\"#000000\"><code>";
echo "#Access file<br>";
echo "order allow,deny<br>";
echo "allow from all<br>";
echo "require valid-user<br>";
echo "Authname \"$area\"<br>";
echo "AuthPAM_Enabled off<br>";
echo "Authtype Basic<br>";
echo "AuthUserFile /home/sites/$domain/web$pfad/.htpasswd";
echo "</code></tr></td></table>";
}
?>
</body>
</html>
---------
steffen