We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

.htpassswd and perl

stevenc317
stevenc317 asked
on
Medium Priority
272 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!!
Comment
Watch Question

ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:

Author

Commented:
ozo what do i do when I get there?  It sends me to a ftp site.  
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
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'}

Author

Commented:
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!!!

Author

Commented:
I can't get the fiel to install, have an other ideas?
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
What problems did you have intalling?
Did you report the problem as instructed?

Author

Commented:
I typed in make (the command they say to use) and it came up with an error.  and no i did not report it.

Author

Commented:
Edited text of question
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
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'

Author

Commented:
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.
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
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)

Author

Commented:
Well I usually do that, but your answer worked perfectly!


ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
That's a switch, most people want to delete the useless answers :-)

Author

Commented:
<g>

Author

Commented:
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?

Author

Commented:
Edited text of question
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
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.

Author

Commented:
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!
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
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

Author

Commented:
what do u mean?

Commented:
Why not use normal server tools? Even FastTrack lets you control access?

Author

Commented:
I want it to be in perl, sorry but that is how i want it done.

thanks anyway,

Steven

Commented:
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....

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.