如何解决ssh-copy-id“错误:无法打开ID文件”错误

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.

从错误文本中可以看到,我们没有任何证书对。 我将其称为证书对,因为有两个名为publicprivate证书。 private证书安全地保存在我们的系统中,而public证书则分发到其他系统。 我们将使用ssh-keygen创建具有默认设置的证书对。 有关ssh-keygen更多详细信息,请参见以下文章。

How To Generate Ssh Key With ssh-keygen In Linux

如何在Linux中使用ssh-keygen生成Ssh密钥

$ ssh-keygen
Generate Certificates with ssh-keygen
Generate Certificates with ssh-keygen
使用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
Copy Certificates with ssh-copy-id
Copy Certificates with ssh-copy-id
使用ssh-copy-id复制证书
LEARN MORE  How To Install and Setup VNC Server On Linux?
了解更多如何在Linux上安装和设置VNC服务器?

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值