35

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

4 Answers 4

54

Try yum provides \*bin/htpasswd

5
  • 3
    But don't forget to escape the wildcard. Apr 14, 2011 at 5: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 ...) Apr 14, 2011 at 5:41
  • @Ignacio: Worked without escaping too ... but maybe that depends on which shell you run ... Apr 14, 2011 at 5: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.
    – user17642
    Apr 14, 2011 at 5:43
  • It all depends on whether or not something matches the pattern you use. mkdir -p bogusbin/htpasswd Apr 14, 2011 at 5:52
67

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

3
  • 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, 2014 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 6, 2014 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, 2015 at 16:18
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!

1

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

yum whatprovides */htpasswd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.