Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I am making a self signed certificate using OpenSSL. I want to make the certificate in one go, means that it will not ask me for the input for Company Name, Common Name etc etc. Is there anyway to do this like a switch e.g. /noprompt or any other through which I can input my all fields in one go. Is it possible that the following command takes all arguments in this call which it takes after pressing enter

openssl x509 -req -days 30 -in request.pem -signkey key.pem -out certificate.pem
share|improve this question

migrated from Jun 24 '10 at 0:07

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Tog, Dave M, Shekhar, Mokubai, Kevin Panko Nov 21 '13 at 21:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Edit: This question was closed as a duplicate of OpenSSL without prompt. See my accepted answer there as well. This answer has now been updated with an ECDSA variant as well. If you can use ECDSA you should.

You need to specify the subject as part of your command.

This command is one step, non-interactive, self-signed certificate creation.

RSA version

openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
    -subj "/C=US/ST=Denial/L=Springfield/O=Dis/" \
    -keyout \

ECDSA version

openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 \
    -days 365 -nodes -x509 \
    -subj "/C=US/ST=Denial/L=Springfield/O=Dis/" \
    -keyout \
share|improve this answer
Brilliant. I didn't know about the non-interactive component and it's exactly what I need to provision a Vagrant VM. – Rob Wilkerson Feb 2 '13 at 19:16
Ditto, want automated certs for Vagrant. – Richard Clayton Nov 20 '13 at 0:49

You can fill a file beforehand to automate the process of creating certificates, in the section named:

"Sample configuration file prompting for field values"


share|improve this answer
Even with that file, the user still has to hit return to confirm each automated value – Gearoid Murphy Dec 4 '12 at 15:12