通过 1 个命令行创建 none 密码 SSH 密钥
Create an none password SSH key by 1 command line
我想通过脚本创建 SSH 密钥
因为无论如何我都要设置空密码,所以我想知道是否可以通过 1 个命令行设置空密码 SSH 密钥。
ssh-keygen -t rsa -b 4096 -C "temp@example.com"
ssh-keygen -t rsa -b 4096 -C "temp@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): tmp_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in tmp_rsa.
Your public key has been saved in tmp_rsa.pub.
The key fingerprint is:
SHA256:R1SEZr34y/4oBRTK3AieT4b8fw1PDG1kUekTfFuHoDA temp@example.com
The key's randomart image is:
+---[RSA 4096]----+
| . E o*+.=+o|
| o * B=..+.++|
| = B++...+ *|
| = .o .+ + |
| S .o. o .|
| o o= |
| .o..o |
| ..o. |
| oo.. |
+----[SHA256]-----+
我正在尝试使用 1 个命令行创建没有密码的 tmp_rsa
文件。
关于如何做到这一点的任何指导都将是一个巨大的帮助!
ssh-keygen
有options在命令行指定密码和输出文件:
-f filename
Specifies the filename of the key file.
-N new_passphrase
Provides the new passphrase.
所以:
$ ssh-keygen -t rsa -b 4096 -C "temp@example.com" -N '' -f tmp_rsa
Generating public/private rsa key pair.
Your identification has been saved in tmp_rsa.
Your public key has been saved in tmp_rsa.pub.
The key fingerprint is:
SHA256:1S94g+i4SBQeqUwQ7uuEx2ZOfp+z8dR+jFBC4qVRj5Y temp@example.com
The key's randomart image is:
+---[RSA 4096]----+
|o. .. |
|.. .o o+ . |
| .. +. *E o . |
|.o o oo..o.o . |
| .o o Soo + . |
|.... o.. . o |
|.o* . o o..o |
|oB ....* .. o |
| .o...=o. .. |
+----[SHA256]-----+
$ ls
tmp_rsa tmp_rsa.pub
我想通过脚本创建 SSH 密钥
因为无论如何我都要设置空密码,所以我想知道是否可以通过 1 个命令行设置空密码 SSH 密钥。
ssh-keygen -t rsa -b 4096 -C "temp@example.com"
ssh-keygen -t rsa -b 4096 -C "temp@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): tmp_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in tmp_rsa.
Your public key has been saved in tmp_rsa.pub.
The key fingerprint is:
SHA256:R1SEZr34y/4oBRTK3AieT4b8fw1PDG1kUekTfFuHoDA temp@example.com
The key's randomart image is:
+---[RSA 4096]----+
| . E o*+.=+o|
| o * B=..+.++|
| = B++...+ *|
| = .o .+ + |
| S .o. o .|
| o o= |
| .o..o |
| ..o. |
| oo.. |
+----[SHA256]-----+
我正在尝试使用 1 个命令行创建没有密码的 tmp_rsa
文件。
关于如何做到这一点的任何指导都将是一个巨大的帮助!
ssh-keygen
有options在命令行指定密码和输出文件:
-f filename
Specifies the filename of the key file.
-N new_passphrase
Provides the new passphrase.
所以:
$ ssh-keygen -t rsa -b 4096 -C "temp@example.com" -N '' -f tmp_rsa
Generating public/private rsa key pair.
Your identification has been saved in tmp_rsa.
Your public key has been saved in tmp_rsa.pub.
The key fingerprint is:
SHA256:1S94g+i4SBQeqUwQ7uuEx2ZOfp+z8dR+jFBC4qVRj5Y temp@example.com
The key's randomart image is:
+---[RSA 4096]----+
|o. .. |
|.. .o o+ . |
| .. +. *E o . |
|.o o oo..o.o . |
| .o o Soo + . |
|.... o.. . o |
|.o* . o o..o |
|oB ....* .. o |
| .o...=o. .. |
+----[SHA256]-----+
$ ls
tmp_rsa tmp_rsa.pub