I use php as a CGI from a secure location to do it all.
To add a user to .htpasswd on Apache:
$thefile=fopen("$pathtofile/.htpasswd", "a");
$newuserline="$username:" . crypt($pass) . "\n";
fwrite($thefile, $newuserline);
kind regards,
bill hollett
YoBro wrote:
> After much
Peter,
You are correct - I did this last year:
$strEncryptedPasswd = crypt($Password, "\0");
$strUserInfo = $UserID.":".$strEncryptedPasswd."\n";
where $Password is the input password & $UserID is the user id.
Just read your .htpasswd file into an array and cycle through it writing out
each
I thought about.
But I need to be able to change user passwords also.
Writing directly to the file will only add another user.
Unless you know any ways of breaking apart the file and picking out the user
names then changing the password for that name.
EG
A typical htpasswd file with two entries..
Actually,
I found out this
By executing what you mentioned earlier:
ls -l
the path I get for htpasswd is...
usr/local/apache/utils
I have then tried in my PHP code
$go = "/user/local/apache/utils/htpasswd -b users/domain/.htpasswd abc
pass";
passthru ("$go");
Still no luck.
"MaD dUCK" <[EM
can you write directly to the password file using crypt() instead of trying
to run the htpasswd program? I think I used to do this in Perl, but it's
been a LONG time since I tried it. I think it worked, though.
Pete.
PS: I'm also pretty sure that if you can't write direclty to the .htpasswd
fi
The .htpasswd file lives in the root of my user account.
ie:
[www] directory
.htpasswd file
It then goes:
[www]
|
[public_html]
[htocs]
|
All website content etc
If I go beyond the www directory, I get a list of hundreds of directories
and files.
This is whe
also sprach YoBro (on Fri, 18 May 2001 10:45:12AM +1200):
> If I try su nobody it asks for nobody's password. If i enter no
> password a I get Authentication denied.
you aren't root.
can you give me an output of 'ls -l '
martin; (greetings from the heart of the sun.)
\ echo m
If I try su nobody it asks for nobody's password. If i enter no password a I
get Authentication denied.
I am able to add users to the htpasswd file via telnet or zoc but my mission
is to get it working using PHP
All the syntax to do it, from what I have seen is relatively straight
forward. but f
also sprach YoBro (on Fri, 18 May 2001 10:34:34AM +1200):
> If i do that using telnet it asks for nobody's password.
do it as root. su is 'switch user' and nobody has no password.
he's trying to get you to execute the command htpasswd just like
apache would execute it when you call passthru in ph
If i do that using telnet it asks for nobody's password.
What does this mean?
"Tyrone Mills" <[EMAIL PROTECTED]> wrote in message
25636AA0C9F6D31192CE00E02905E08602D6E476@mailkel01">news:25636AA0C9F6D31192CE00E02905E08602D6E476@mailkel01...
> su nobody -c "/usr/local/bin/htpasswd -b /users/domai
su nobody -c "/usr/local/bin/htpasswd -b /users/domain/.htpasswd abc pass"
See what you get...
"YoBro" <[EMAIL PROTECTED]> wrote in message
news:<9e1i8t$op5$[EMAIL PROTECTED]>...
> I have set the htpasswd file to 777 while i attempt to get this to work.
>
> I have found the htpasswd executable
This works for me...
$update = exec ("/usr/local/apache/bin/htpasswd -b ./.htpasswd $username
$password");
Just make sure that the user that Apache runs under has the appropriate
permissions to the .htpasswd file.
Tyrone
"YoBro" <[EMAIL PROTECTED]> wrote in message
news:<9e1fcd$pir$[EMAIL PROT
I have set the htpasswd file to 777 while i attempt to get this to work.
I have found the htpasswd executable.
/usr/local/bin
So my code now reads:
Still no go.
Any ideas to view errors while I attempt to write to the file .htpasswd
YoBro
"Shawn Reed" <[EMAIL PROTECTED]> wrote in message
01C0
the user that the webserver runs as (usually "apache" or "nobody") must have write
permissions to the file which htpasswd is attempting to write to, or else it won't be
able to make the changes you are attempting to make.
~shawn
YoBro <[EMAIL PROTECTED]> wrote in message
news:<9e1h4j$8k5$[EM
What permissions do you need to execute htpasswd?
--
phill
""YoBro"" <[EMAIL PROTECTED]> wrote in message
9e1h4j$8k5$[EMAIL PROTECTED]">news:9e1h4j$8k5$[EMAIL PROTECTED]...
> That didn't seem to work.
> I am beginning to pull my hair out now.
>
> ""Tolga "thorr" Orhon"" <[EMAIL PROTECTED]> wrote
That didn't seem to work.
I am beginning to pull my hair out now.
""Tolga "thorr" Orhon"" <[EMAIL PROTECTED]> wrote in message
9e1gjb$u1q$[EMAIL PROTECTED]">news:9e1gjb$u1q$[EMAIL PROTECTED]...
> I mean the absolute path for executable.
>
> passthru ("/usr/bin/htpasswd -b /users/domain/.htpasswd
I mean the absolute path for executable.
thorr
""YoBro"" <[EMAIL PROTECTED]> wrote in message
9e1gb1$jnn$[EMAIL PROTECTED]">news:9e1gb1$jnn$[EMAIL PROTECTED]...
> My message described the absolute path with the provider I use.
>
> I am able to download the .htpasswd file from
> /users/domain/
My message described the absolute path with the provider I use.
I am able to download the .htpasswd file from
/users/domain/
Still not working though.
""Tolga "thorr" Orhon"" <[EMAIL PROTECTED]> wrote in message
9e1fth$vi3$[EMAIL PROTECTED]">news:9e1fth$vi3$[EMAIL PROTECTED]...
> May be you nee
May be you need to use absolute path for htpasswd. eg. /usr/bin/htpasswd
Did u check for any error msgs?
thorr
""YoBro"" <[EMAIL PROTECTED]> wrote in message
9e1fcd$pir$[EMAIL PROTECTED]">news:9e1fcd$pir$[EMAIL PROTECTED]...
> After much investigation through many newsgroups and websites, I foun
After much investigation through many newsgroups and websites, I found out
that this is the way you can execute a unix apache command to add a user to
the htpasswd list with PHP.
Problem is, it doesn't add any information to the htpasswd file.
Note: The example below is...
domain = my user name
a
20 matches
Mail list logo