ssh
provides secure access to the remote systems console or command line. All linux boxes uses ssh
securely. There are a lot of steps to make things secure and easy while connecting and using ssh. ssh
provides passwordless authentication with certificates. We can use ssh-copy-id
to send our certificate to the remote system but what can we do if we get following error
ssh
提供对远程系统控制台或命令行的安全访问。 所有Linux机器都安全地使用ssh
。 在连接和使用ssh时,有很多步骤可以使事情变得安全且容易。 ssh
使用证书提供无密码身份验证。 我们可以使用ssh-copy-id
将证书发送到远程系统,但是如果遇到以下错误,我们该怎么办
/usr/bin/ssh-copy-id: ERROR: failed to open ID file '/home/ismail/.pub': No such file
(to install the contents of '/home/ismail/.pub' anyway, look at the -f option)
尝试ssh-copy-id (Try ssh-copy-id)
Now we want to copy our ssh public certificate with ssh-copy-id
command. We just provide the remote host we want to copy. The user will be the current username which is ismail
in this case. We can also specify the username like [email protected]
.
现在,我们要使用ssh-copy-id
命令复制ssh公共证书。 我们只提供我们要复制的远程主机。 在这种情况下,用户将是当前用户名,即ismail
。 我们还可以指定用户名,例如[email protected]
。
$ ssh-copy-id poftut1

使用ssh-keygen生成证书 (Generate Certificates with ssh-keygen)
As we see from the error text we do not have any certificate pair. I call it certificate pair because there is two certificate named public
and private
. private
certificate is hold securely in our system and public
certificate is distributed to the other systems. We will use ssh-keygen
to create a certificate pair with default settings. More detailed about ssh-keygen
can be found following post.
从错误文本中可以看到,我们没有任何证书对。 我将其称为证书对,因为有两个名为public
和private
证书。 private
证书安全地保存在我们的系统中,而public
证书则分发到其他系统。 我们将使用ssh-keygen
创建具有默认设置的证书对。 有关ssh-keygen
更多详细信息,请参见以下文章。
How To Generate Ssh Key With ssh-keygen In Linux
$ ssh-keygen

使用ssh-copy-id复制证书(Copy Certificates with ssh-copy-id)
Now we can copy our certificate to the remote system without problem.
现在,我们可以将证书复制到远程系统而不会出现问题。
$ ssh-copy-id poftut1

翻译自: https://www.poftut.com/solve-ssh-copy-id-error-failed-open-id-file-error/