Manually Uploading SSL Certificates via SSH on Apache/OpenSSL

Author:Nils Krämer
Updated:May 1, 2025

To manually upload an SSL certificate using SSH, follow these organized steps:

  1. Connect to your server via SSH:

    • Open a terminal and type:
      ssh username@host.com
      

    Replace username and host.com with your actual credentials.

  2. Navigate to the SSL directory on the server:

    • Create a new directory if needed:
      mkdir ssl
      
    • Move into the directory or create it in the current location as needed.
  3. Create empty files for each SSL component (e.g., cert.pem, ca_bundle.pem, privateKey.pem):

    • Use touch to create each file:
      touch ssl/cert.pem
      touch ssl/ca_bundle.pem
      touch ssl/privateKey.pem
      
  4. Transfer SSL files from your local machine:

    • Use SCP mode in SSH for secure and efficient transfer:
      scp cert.pem username@host.com:/path/to/ssl/cert.pem
      scp ca_bundle.pem username@host.com:/path/to/ssl/ca_bundle.pem
      scp privateKey.pem username@host.com:/path/to/ssl/privateKey.pem
      
    • Replace paths with your server's directory structure.
  5. Alternative method: Paste directly into SSH session:

    • After creating the file on the server, paste the content:
      cat - > ssl/cert.pem
      
    • Press Enter to start pasting, then press Ctrl+D to exit and save.
  6. Verify files:

    • Check each file after upload:
      cat ssl/cert.pem
      
  7. Log out of the SSH session when done:

    • Type exit or logout to terminate the connection.