Solved

.htpassswd and perl

Posted on 1997-11-03
24
240 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

20 Experts available now in Live!

Get 1:1 Help Now