37

For apache, there is the htpasswd utility, which can be used to generate encrypted passwords for .htaccess access restriction etc. In Ubuntu I can install it via the apache2-utils package, but in Scientific Linux (Red Hat) I find only the following package, when I do yum search htpasswd:

perl-Apache-Htpasswd.noarch : Manage Unix crypt-style password file

but this does not seem to be the package I'm looking for, since it does not include the htpasswd command, and also when I do apt-cache search htpasswd in Ubuntu, I get:

libapache-htpasswd-perl - Manage Unix crypt-style password file
lighttpd - A fast webserver with minimal memory footprint
nanoweb - HTTP server written in PHP
apache2-utils - utility programs for webservers

... where the first one is quite obviously the one corresponding to the one I found for Red Hat above(?).

So, is there any equivalent to the apache2-utils package, or any other package including the htpassd utility, for Red Hat/Scientific Linux? At least I can't find it ...

Samuel Lampa
  • 515
  • 1
  • 4
  • 7

4 Answers4

70

It's yum install httpd-tools. Just found it today.

  • 4
    In CentOS at least, `httpd-tools` *does* provide htpasswd. I found it using `yum provides \*bin/htpasswd` ;) Great way to get htpasswd without installing the httpd server (often not desirable if you're running another web server already, or don't want to run a web server) – Doktor J Mar 31 '14 at 15:31
  • 2
    RHEL6 - # yum install httpd-tools does have htpasswd utility. Run yum provides \*bin/htpasswd, and it will show that https-tools provides the htpasswd utility. – xpros Aug 06 '14 at 17:38
  • 1
    no working this yum provides \*bin/htpasswd and this yum install httpd-tools any solution for centos 6.0? – jonathan Nov 18 '15 at 16:18
55

Try yum provides \*bin/htpasswd

  • 3
    But don't forget to escape the wildcard. – Ignacio Vazquez-Abrams Apr 14 '11 at 05:37
  • Ah, thanks! (Even better than just providing the answer ... helping me to help myself :)). So ... turns out that it is provided with the httpd package itself. Well, that explains it. (Was trying to use the htpasswd from a server which did not have apache installed, but only the file system to be published on www ...) – Samuel Lampa Apr 14 '11 at 05:41
  • @Ignacio: Worked without escaping too ... but maybe that depends on which shell you run ... – Samuel Lampa Apr 14 '11 at 05:43
  • I learned something too, although to be honest I don't know why you're supposed to. It appears to work without escaping in CentOS 5.6, but I guess there's another reason for it. –  Apr 14 '11 at 05:43
  • It all depends on whether or not something matches the pattern you use. `mkdir -p bogusbin/htpasswd` – Ignacio Vazquez-Abrams Apr 14 '11 at 05:52
1

If you are not sure where the utility is located, use:

whereis htpasswd

For my server, it was installed on /usr/bin/htpasswd

Cheers!

Ndianabasi
  • 189
  • 1
  • 1
1

This command searches for which packages provide the requested dependency of file. This also takes wildcards for files.

yum whatprovides */htpasswd
MadHatter
  • 78,442
  • 20
  • 178
  • 229