How to Determine OpenSSL’s Default Directory OPENSSLDIR

My Problem

While using certain tools that rely on the OpenSSL package, I was looking for a way to determine what the main directory for OpenSSL is on any given installation. This is particularly useful for finding where the main cert.pem file is. That location is different on various systems, and if OpenSSL has been compiled outside of a package, the --openssldir option can be changed to something outside of the norm, further upsetting you.

My Solution

In a shell, use the following command:

openssl version -d

In my case, on a RedHat derivative with the standard OpenSSL package, the response was:

OPENSSLDIR: "/etc/pki/tls"


  1. Luca Francesca

    January 27, 2014 at 8:21 am

    It works on Mac Os X Mavericks too 🙂


  2. Fábio Capuano

    March 15, 2017 at 12:22 pm

    Thanks for posting this!


Leave a Reply

Your email address will not be published. Required fields are marked *

Follow TheNubbyAdmin!

follow us in feedly

Raw RSS Feed:

Contact Me!

Want to hire me as a consultant? Have a job you think I might be interested in? Drop me a line:

Contact Me!

Subscribe via Email

Your email address is handled by Google FeedBurner and never spammed!

The Nubby Archives

Circle Me on Google+!

Photos from Flickr

Me on StackExchange

The IT Crowd Strava Group