๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

๐Ÿ’ก Firewall & Security August 15, 2026 4

Linux Command: openssl

OpenSSL command line tool for cryptography and SSL/TLS

Terminal โ€” Firewall & Security
Command
$ openssl genrsa -out server.key 4096
Output
Generating RSA private key, 4096 bit long modulus

openssl is a cryptographic toolkit for SSL/TLS operations, certificate management, encryption, hashing, and key generation. It is the Swiss Army knife of cryptography on Linux. openssl is used for generating SSL certificates, creating certificate signing requests (CSRs), testing SSL connections, encrypting/decrypting files, and generating random data. For web servers, openssl is essential for generating private keys, creating CSRs for certificate authorities, and converting between certificate formats (PEM, DER, PFX).

Syntax

openssl COMMAND [OPTION]...

Key Options

  • genrsa โ€” Generate RSA private key
  • req โ€” Create certificate signing request
  • x509 โ€” Create/examine X.509 certificates
  • s_client โ€” Test SSL/TLS connection
  • enc โ€” Encrypt/decrypt files
  • rand โ€” Generate random data

Examples

Generate private key

openssl genrsa -out server.key 4096

Output: Generating RSA private key, 4096 bit long modulus

Generate CSR

openssl req -new -key server.key -out server.csr

Self-signed certificate

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes

Pro Tips

  • echo | openssl s_client -connect host:443 2>/dev/null | openssl x509 -text quickly shows any server certificate.
  • Private keys must be 600 permissions and never shared. chmod 600 server.key immediately after generation.
  • For production SSL certificates, use certbot (Let's Encrypt) instead of self-signed. openssl is for testing and CSR generation.

Learn more: Full openssl reference โ†’

Share this tip