Commands.page Logo

Download File with Custom SSL Certificate Ubuntu Linux

This article provides a concise guide on downloading files within the Ubuntu operating system using a specific SSL certificate file. It covers the standard command-line tools required to bypass default certificate authorities and utilize your own custom security credentials for secure transfers.

Using curl to Download with Custom Certificate

The curl command is the most common tool for transferring data with URLs. To specify a custom Certificate Authority (CA) bundle, use the --cacert option. Run the following command in your terminal:

curl --cacert /path/to/your/certificate.pem -O https://example.com/file.zip

Replace /path/to/your/certificate.pem with the actual location of your custom certificate file. The -O flag saves the file using its remote name.

Using wget to Download with Custom Certificate

If you prefer wget, you can achieve the same result using the --ca-certificate flag. This tells wget to verify the server’s identity using your provided file instead of the system defaults. Execute the command below:

wget --ca-certificate=/path/to/your/certificate.pem https://example.com/file.zip

Ensure the path to the certificate is accurate to avoid verification errors. Both methods allow you to securely download resources from servers that use private or self-signed SSL certificates on Ubuntu.