Trouble setting up basic user authentication on apache2 web server

So run zypper install thttpd?

Cuz if so, i ran that command and it doesnt work

In what way does it "doesn't work"?

zypper install thttpd

Refreshing service 'spacewalk'.
Loading repository data...
Reading installed packages...
'thttpd' not found in package names. Trying capabilities.
No provider of 'thttpd' found.
Resolving package dependencies...

Nothing to do.

Grrr... Well, as a last resort:

1 Like

So just create passwd, and insert that program into it?

Put that in htpasswd.pl, chmod +x ./htpasswd.pl , ./htpasswd.pl options and stuff

Its supposed to act like a normal htpasswd supposedly.

1 Like

What did you mean by the last part?

./htpasswd.pl options and stuff

Dot, then slash, which means 'current directory'. So you are running htpasswd.pl from the current directory.

The 'options and stuff' are the usual options you would expect htpasswd to use.

1 Like

Alright

So using this guide Authentication and Authorization - Apache HTTP Server Version 2.2, instead of running

 htpasswd -c /usr/local/apache/passwd/passwords rbowen     

Would I be running :

 htpasswd.pl -c /opt/apache2/passwd/passwords rbowen

I really appreciate your help Corona, sorry for asking tons of questions.

No, you would be running:

./htpasswd.pl -c /usr/local/apache/passwd/passwords rbowen
./htpasswd.pl -c /usr/local/apache/passwd/passwords rbowen

./htpasswd.pl: line 1: sswd.pl: command not found
./htpasswd.pl: line 17: use: command not found
./htpasswd.pl: line 18: use: command not found
./htpasswd.pl: line 20: use: command not found
./htpasswd.pl: line 21: use: command not found
./htpasswd.pl: line 23: ::Std::STANDARD_HELP_VERSION: command not found
./htpasswd.pl: line 24: my: command not found
./htpasswd.pl: line 25: syntax error near unexpected token `('
./htpasswd.pl: line 25: `my %opt = ('

Im starting to think this will never work :frowning:

What do you have as the very first line of the script?

It needs to be #!/usr/bin/env perl otherwise it will not be run with PERL

1 Like

argghhhhhhhh !!! I edited the first line to include what you have and ran

/htpasswd.pl -c /usr/local/apache/passwd/passwords rbowen

And i get these messages:

Can't locate Authen/Htpasswd.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at ./htpasswd.pl line 22.
BEGIN failed--compilation aborted at ./htpasswd.pl line 22.

It's not "What I have" by the way, it's exactly like it was in the link.

You need to install perl-Apache-Htpasswd.

 zypper install perl-apache2-htpasswd

Refreshing service 'spacewalk'.
Loading repository data...
Reading installed packages...
Package 'perl-apache2-htpasswd' not found.
Resolving package dependencies...

Nothing to do.

P.S I tried just apache, and tried capitilizing, still the same result.

You may have to install with CPAN. It'd be called Authen:Htpasswd there I think.

Something like 'install Authen:Htpasswd' from the CPAN prompt, once 'cpan' is done asking you questions.

zypper install Authen:htpasswd

Refreshing service 'spacewalk'.
Loading repository data...
Reading installed packages...
'Authen:htpasswd' not found in package names. Trying capabilities.
No provider of 'Authen:htpasswd' found.
Resolving package dependencies...

Nothing to do.

Perl has its own installer system, 'cpan'. Run it as root and answer its questions, then 'install Authen:Htpasswd'

hmm what code would i be running?

gentoo ~ # cpan

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes]

Autoconfigured everything but 'urllist'.

Now you need to choose your CPAN mirror sites.  You can let me
pick mirrors for you, you can select them from a list or you
can enter them by hand.

Would you like me to automatically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes]
Trying to fetch a mirror list from the Internet
Fetching with HTTP::Tiny:
http://www.perl.org/CPAN/MIRRORED.BY

Looking for CPAN mirrors near you (please be patient)
.......................... done!

New urllist
  http://mirrors.rit.edu/CPAN/
  http://mirror.metrocast.net/cpan/
  http://ftp.wayne.edu/CPAN/

Autoconfiguration complete.

commit: wrote '/root/.cpan/CPAN/MyConfig.pm'

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.

cpan[1]> install Authen:htpasswd

<lots and LOTS of scroll>

...
Result: PASS
  MSTROUT/Authen-Htpasswd-0.171.tar.gz
  /usr/bin/make test -- OK
Running make install
Installing /usr/local/lib64/perl5/5.18.2/Authen/Htpasswd.pm
Installing /usr/local/lib64/perl5/5.18.2/Authen/Htpasswd/User.pm
Installing /usr/local/lib64/perl5/5.18.2/Authen/Htpasswd/Util.pm
Installing /usr/local/man/man3/Authen::Htpasswd::User.3pm
Installing /usr/local/man/man3/Authen::Htpasswd.3pm
Installing /usr/local/man/man3/Authen::Htpasswd::Util.3pm
Appending installation info to /usr/local/lib64/perl5/5.18.2/x86_64-linux/perllocal.pod
  MSTROUT/Authen-Htpasswd-0.171.tar.gz
  /usr/bin/make install  -- OK

cpan[2]> exit

Terminal does not support GetHistory.
Lockfile removed.
gentoo ~ #
1 Like