在命令中输入输入?

在命令中输入输入?

我正在通过需要创建 OpenVPN 帐户的程序运行命令。输入此行后即可开始创建帐户:

cd /etc/openvpn/easy-rsa; . ./vars; ./build-key username

我需要输入 10 次无输入(例如按 Enter 键),然后按 y 键两次。它需要全部放在这一行中。这可能吗?提前致谢。

编辑:

root@suffice-vpn:~# cd /etc/openvpn/easy-rsa; . ./vars; <<<$'\n\n\n\n\n\n\n\n\n\nyy' ./build-key username
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/keys
Generating a 2048 bit RSA private key
..............+++
.....................+++
writing new private key to 'username.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:State or Province Name (full name) [NY]:Locality Name (eg, city) [Merrick]:Organization Name (eg, company) [IceWare]:Organizational Unit Name (eg, section) [IceWare]:Common Name (eg, your name or your server's hostname) [username]:Name [server]:Email Address [[email protected]]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:An optional company name []:Using configuration from /etc/openvpn/easy-rsa/openssl-1.0.0.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName           :PRINTABLE:'US'
stateOrProvinceName   :PRINTABLE:'NY'
localityName          :PRINTABLE:'Merrick'
organizationName      :PRINTABLE:'IceWare'
organizationalUnitName:PRINTABLE:'IceWare'
commonName            :PRINTABLE:'username'
name                  :PRINTABLE:'server'
emailAddress          :IA5STRING:'[email protected]'
Certificate is to be certified until Jan 14 16:59:03 2026 GMT (3650 days)
Sign the certificate? [y/n]:CERTIFICATE WILL NOT BE CERTIFIED: I/O error
root@suffice-vpn:/etc/openvpn/easy-rsa#

正如您所看到的,它经历了填空的过程 [保留我希望保持不变的所有信息],但随后我收到了这个 I/O 错误。

答案1

我使用以下命令解决了这个问题:

cd /etc/openvpn/easy-rsa; . ./vars; ./build-key --batch username

相关内容