LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-02-2015, 11:07 AM   #1
LinuxIntern445
LQ Newbie
 
Registered: Feb 2015
Posts: 5

Rep: Reputation: Disabled
Trouble setting up basic user authentication on apache2 web server


Hey guys!

So I decided to set up some basic user authentication on my apache2 server, and I am running into some problems. I followed the documentation provided by apache on their website, but I cant create the password file for some reason. I did a little trouble shooting myself, and found out that I need to use htpasswd2.1 as opposed to htpasswd(which is nowhere to be found).

The specific part I am stuck with, is running this command:

htpasswd2.1 -c /opt/apache2/passwords user1

It's displaying htpasswd2.1: command not found.

I am completely stuck, and seeking assistance. Thanks in advance for taking the time to review this.
 
Old 02-02-2015, 07:13 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,255

Rep: Reputation: 559Reputation: 559Reputation: 559Reputation: 559Reputation: 559Reputation: 559
try
Code:
htpasswd -c /opt/apache2/passwords user1
 
Old 02-04-2015, 09:16 AM   #3
LinuxIntern445
LQ Newbie
 
Registered: Feb 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Keith Hedger View Post
try
Code:
htpasswd -c /opt/apache2/passwords user1
Code:
htpasswd -c /opt/apache2/passwords user1
If 'htpasswd' is not a typo you can run the following command to lookup the package that contains the binary:
command-not-found htpasswd
bash: htpasswd: command not found
 
Old 02-04-2015, 09:56 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,172

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
You don't mention what Linux distribution you're using or how you installed apache, so can't give you specific help.

I know that with CentOS you can "yum install httpd-tools" to install a package that contains htpasswd, it may be similar for your distro.
 
Old 02-04-2015, 09:58 AM   #5
LinuxIntern445
LQ Newbie
 
Registered: Feb 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TenTenths View Post
You don't mention what Linux distribution you're using or how you installed apache, so can't give you specific help.

I know that with CentOS you can "yum install httpd-tools" to install a package that contains htpasswd, it may be similar for your distro.
I apologize, I am using openSUSE and am running apache2 fine. I have triied "zypper install htpasswd" but it is not working.

Please let me know if you have any other questions in helping you resolve my issue, and thank you for lending a hand.
 
Old 02-04-2015, 10:04 AM   #6
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,172

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
Try:
Code:
find / -name "*htpasswd*"
and see if any of the paths mention /bin/

If you get nothing back then it's not installed.
 
Old 02-04-2015, 10:08 AM   #7
LinuxIntern445
LQ Newbie
 
Registered: Feb 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TenTenths View Post
Try:
Code:
find / -name "*htpasswd*"
and see if any of the paths mention /bin/

If you get nothing back then it's not installed.

Code:
find / -name "*htpasswd*"
Output:

/opt/apache2/htpasswd.pl
/opt/apache2/htpasswd2.1
/opt/htpasswd2.1.gz
find: `/var/lib/ntp/proc/15854/net': Invalid argument
/usr/share/doc/packages/apache2/SHA1/htpasswd-sha1.pl
/usr/share/man/man1/htpasswd2.1.gz
find: `/proc/15854/net': Invalid argument
 
Old 02-04-2015, 10:10 AM   #8
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,172

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
Ok, try....

Code:
/opt/apache2/htpasswd2.1 -c /opt/apache2/passwords user1
 
Old 02-04-2015, 10:15 AM   #9
LinuxIntern445
LQ Newbie
 
Registered: Feb 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TenTenths View Post
Ok, try....

Code:
/opt/apache2/htpasswd2.1 -c /opt/apache2/passwords user1

Code:
/opt/apache2/htpasswd2.1 -c /opt/apache2/passwords user1
output:
bash: /opt/apache2/htpasswd2.1: Permission denied
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
(SOLVED) Apache2 basic authentication not working beliya Linux - Server 4 04-14-2013 01:51 PM
Problem with setting up authentication on an Apache2 server kaplan71 Linux - Software 1 01-04-2011 12:58 PM
Looking for a very basic HOWTO on setting up a web server CatchFlipsidE Linux - Newbie 5 08-25-2004 02:02 PM
Apache2 not prompting for basic authentication elias4444 Debian 0 08-04-2004 01:03 PM
Apache users - Basic login authentication with Apache2 piglingz Linux - Software 1 04-06-2003 10:52 PM


All times are GMT -5. The time now is 06:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration