How to generate certificates for subdomains once without entering options in several steps

My domain is:

I ran this command: sudo certbot -d *

Then it asks me to choose between these:

1: Attempt to reinstall this existing certificate
2: Renew & replace the certificate (may be subject to CA rate limits)

Here I permanently prefer 1 and then after pressing enter, it is asking for this to select the subdomains in the virtual host that I want to generate certificates:

Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):

In this case I permanently prefer press to "Enter" button to generate certificate for all.

Is there possibility to use one command instead of above steps to generate certificates? I'm trying to generate certificates programmatically.

For programmatic use, make sure you are including the --non-interactive flag. This way, Certbot will either assume a default behavior or produce an error.

Every prompt (I think) can be answered automatically with flags. For example, the first one would be --keep-until-expiring or --reinstall (same thing). Check out certbot --help all for a full accounting of flags.


Thank you for you solution. --reinstall worked and it avoid selecting between first two options. I found another way for the last selection(Where I want to press 'Enter' button).

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.