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.
First, file ./htpasswd2.1 to make sure its what you think it is.
I'm surprised your distribution didn't come with htpasswd though. It might be a slightly different name -- htpasswd instead of htpasswd2.1 -- or not in your PATH. Try whereis htpasswd
As for the htpasswd, I read a couple other forums and someone said if you are using apache2, it should be htpasswd2. The only thing with that is, I have a htpasswd2.1 and no htpasswd to be found.
I ran that command as you suggested, and nothing is coming up
As I suspected, the file you have is not a program -- it is a manual page.
What is your distribution? That would help explain where htpasswd is hiding, or what you need to install to have it. (You really shouldn't go around running random files you downloaded from the internet.)
That advice may be a little old. On my system, htpasswd and htpasswd2 are the same program.
$ ls -l /usr/sbin/htpasswd*
-rwxr-xr-x 1 root root 18688 May 23 2014 /usr/sbin/htpasswd
lrwxrwxrwx 1 root root 18 May 23 2014 /usr/sbin/htpasswd2 -> /usr/sbin/htpasswd
$
Refreshing service 'spacewalk'.
Loading repository data...
Reading installed packages...
'apache2-utils' is already installed.
No update candidate for 'apache2-utils-2.2.12-1.50.1.x86_64'. The highest available version is already installed.
Resolving package dependencies...
Installing thttpd -- an alternative http server -- apparently installs its own htpasswd with it in SuSe. You don't have to use its daemon, just install it to get that tool.