我正在尝试创建一个 SSH 密钥,以便最终用于连接基于云的 VM。
(base) Mac:~ user$ ssh-keygen -t rsa -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/<my_account>/.ssh/id_rsa): test123
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in test123.
Your public key has been saved in test123.pub.
The key fingerprint is:
SHA256:123123123123123 [email protected]
The key's randomart image is:
+---[RSA 2048]----+
| REDACTED |
+----[SHA256]-----+
现在根据教程,关键应该在
/Users/<my_account>/.ssh/id_rsa.pub
/.ssh
除了一个名为的文件之外,似乎没有其他内容known_hosts
。我哪里做错了?
答案1
好的,看来当我给它一个文件名时,它被保存在其他地方或根本没有保存。
Enter file in which to save the key (/Users/<my_account>/.ssh/id_rsa): test123
因此我没有这样做,而是将其留空,现在 ida_rsa.pub 文件已经出现。
Enter file in which to save the key (/Users/<my_account>/.ssh/id_rsa):
~/.ssh
然后cd inls
id_rsa id_rsa.pub known_hosts
答案2
我认为这里的混淆是输入短语: 输入保存密钥的文件 (/Users/<my_account>/.ssh/id_rsa):
我还假设路径是 /Users/<my_account>/.ssh
答案3
您可以指定任何您想要的文件名。您犯的错误是您正在查看 .ssh 目录。如果您以与文件名 test123 类似的方式创建 ssh 密钥,您将在路径 c:/Users/<my_account>/ 中找到 test123.pub(公钥)和 test123(私钥)