c_rehash : Command not found error – Solution

Updated on September 15, 2021

Question: Hi, I was trying to rehash the certificates on CentOS 7 using c_rehash. However, I see the error c_rehash command not found.

$ c_rehash $HOME/.certs/
-bash: c_rehash: command not found

I thought the command should be installed as part of OpenSSL and OpenSSL development packages, but that’s not the case.

I could not install c_rehash via YUM as well.

# yum install c_rehash
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.piconets.webwerks.in
 * extras: mirrors.piconets.webwerks.in
 * updates: centos.mirror.snu.edu.in
base                                                     | 3.6 kB     00:00
extras                                                   | 2.9 kB     00:00
updates                                                  | 2.9 kB     00:00
Not using downloaded updates/repomd.xml because it is older than what we have:
Current   : Thu Aug  5 15:41:14 2021
Downloaded: Tue Aug  3 16:10:37 2021
No package c_rehash available.

Can you help me fix this issue? – Sam.

Solution: Install C_rehash script

Sam, c_rehash script is available as part of the OpenSSL Perl package. So installing openssl-perl should solve the issue.

# yum install openssl-perl

or

# yum install /usr/bin/c_rehash
Resolving Dependencies
--> Running transaction check
---> Package openssl-perl.x86_64 1:1.0.2k-21.el7_9 will be installed
--> Processing Dependency: perl(WWW::Curl::Easy) for package: 1:openssl-perl-1.0.2k-21.el7_9.x86_64
--> Running transaction check
---> Package perl-WWW-Curl.x86_64 0:4.15-13.el7 will be installed
--> Finished Dependency Resolution

That’s it!

Was this article helpful?

Related Articles

Leave a Comment