Solved

.htpassswd and perl

Posted on 1997-11-03
24
243 Views
Last Modified: 2008-03-03
Hi,
I have just setup a .htpasswd password thing on one of the directories of my web page.  I would like to have a perl script that would create user names and passwords. I think  the easiest way for it to work, would be to have it run some UNIX comands. But I do not know how to get it to do that.  Because when you are adding a user it asks for  the password twice.  Here is the commands that I use (when in my telnet app).

cd htdocs
cd login
htpasswd .htpasswd USER NAME

then asks for password twice so I type it in twice.  That is what I can't figure out how to do.  I know it can be done cause experts-exchange uses it for their member system.


thanks!!
0
Comment
Question by:stevenc317
24 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1208060
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208061
ozo what do i do when I get there?  It sends me to a ftp site.  
0
 
LVL 84

Expert Comment

by:ozo
ID: 1208062
You might try downloading the HTTPD-Tools-0.55.tar.gz file there,
and seeing if the HTTPD module for managing ccess control files does what you want.
(unless you can tell by the HTTPD-Tools-0.55.readme that it does not,
in which case you might clarify your question)

On the second part of your question, try looking at $ENV{'REMOTE_USER'}
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208063
Ok the second part works, THANKS!!!  I will check out that page now!  If you would like to see the second thing in action please go to html.tou.com/  (for sign up for a login id).

thanks

SO MUCH!!!
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208064
I can't get the fiel to install, have an other ideas?
0
 
LVL 84

Expert Comment

by:ozo
ID: 1208065
What problems did you have intalling?
Did you report the problem as instructed?
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208066
I typed in make (the command they say to use) and it came up with an error.  and no i did not report it.
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208067
Edited text of question
0
 
LVL 84

Expert Comment

by:ozo
ID: 1208068
What errors did it come up with?

To do a telnet from perl, see
http://www.perl.com/CPAN/doc/manual/html/pod/perlfaq8/Can_I_use_perl_to_run_a_telnet_o.html
http://www.perl.com/CPAN/doc/wwwman/libnet/Net/Telnet.html
http://www.perl.com/CPAN/authors/id/JROGERS/Net-Telnet-3.00.readme
To run interactive user commands, see
http://www.perl.com/CPAN/authors/id/ERICA/Comm.pl-1.8.tar.gz

BTW, I can't seem to find your other question, qid=8630023345 "HELP"
about $member eq 'webmaster'

0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208069
I will look into those pages!

Sorry bout that, I deleted it.  Since you answered my question there was no need to leave it up.  If you just wanted to see what is said, I said thanks.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1208070
I think the idea of this site is to grade the best answers and leave
them with previously asked questions for others to benefit from.
(but I suppose it was too specific a question to be of much general interest)
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208071
Well I usually do that, but your answer worked perfectly!


0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 84

Expert Comment

by:ozo
ID: 1208072
That's a switch, most people want to delete the useless answers :-)
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208073
<g>
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208074
http://www.perl.com/CPAN/authors/id/JROGERS/Net-Telnet-3.00.readme

looks good, but I alwasy have trouble installing things like that.  With the make commands.  In what directory should I install it from?  I have tried in the home dir (i think it is called that, it is the directory that comes up when I login).

can u please tell me where to install that thing?
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208075
Edited text of question
0
 
LVL 84

Expert Comment

by:ozo
ID: 1208076
On question 8630023522, I meant to say you could add diagnostics like
 || die "Can't open logfile.txt because $!";
and
 print "Mail status: $?\n";
at the end of the existing
 open(TLOG, "logfile.txt")
and
  close MAIL;
statements, not that you should add them as completly new lines.
And when called through cgi, the error messages will go to the
server error log, and not back to the browser.

0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208077
thanks for answering that question, sorry i can't give you the credits (cause I ened this question answered).  I just put a new question up (I think i called it Mail ...) it should be at the top.  If you can answer that one I will give you the 45 points.  (sorry all i have).

thanks!
0
 
LVL 84

Expert Comment

by:ozo
ID: 1208078
Also, given your
   # read in templog
                open(TLOG, "logfile.txt");
                while (<TLOG>) {
                $sendThis .= $_;
                }
                close TLOG;
It seems redundant to have
  # clear templog
                rename("logfile.txt","logfile.$$");
                open(TLOG,"logfile.$$");
                {local $/=undef;$SendThis=<TLOG>}
                close TLOG;
                unlink "logfile.$$";  
I think the latter was meant to replace the former

0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208079
what do u mean?
0
 
LVL 1

Expert Comment

by:malec
ID: 1208080
Why not use normal server tools? Even FastTrack lets you control access?
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1208081
I want it to be in perl, sorry but that is how i want it done.

thanks anyway,

Steven
0
 

Expert Comment

by:kistler
ID: 1208082
You may separately ask for the same password twice with
java script on the www page, and only submit, if it's the
same, and then put it with perl into a database. And perl
has the crypt command to use as: crypt(passwd,salt); But maybe
I did not propperly understand the question....
0
 

Accepted Solution

by:
4099aol earned 100 total points
ID: 1208083
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sending email via Perl on Windows 3 138
Which version of C should I use when Perl is too slow? 13 173
pipe to sed or perl, please help 5 127
batch script for automated email 12 101
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now