我不明白为什么在我读到的关于使用 SSH key 向服务器验证客户端身份的每本教程或书籍中,他们都会重新创建一对 SSH key ?
你安装ssh客户端的时候不是已经创建了pair吗?就像在 ubuntu 中一样,执行以下操作后:apt-get install ssh openssh-client
,当您转到/etc/ssh
时,您会找到您的 key !
那么为什么要重新生成它们呢?为什么 ssh-copy-id
不使用 /etc/ssh
目录中的这些 key ?
谢谢
最佳答案
Isn't the pair already created when you install ssh client?
不,不是。
like in ubuntu, after doing : apt-get install ssh openssh-client, when you go to /etc/ssh, you find your keys!
这些不是身份验证 key ,而是服务器主机 key 。如果您只安装 openssh-clients
,则不会创建这些 key 。仅当您安装 openssh-server
时才会创建它们!
So why regenerate them? and why ssh-copy-id doesn't use these keys, in /etc/ssh directory?
上面已经回答了。它们不是身份验证 key ,而是服务器主机 key 。身份验证 key 是针对每个用户的,位于您的主目录 (~/.ssh/
) 中。
关于security - 如果 SSH key 是自动创建的,为什么还要重新创建它们?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35086610/