尝试复制 SSH key 时通过 Homebrew 错误安装 ssh-copy-id

标签 ssh ssh-keys

我安装了ssh-copy-id通过自制。

当我输入 ssh-copy-id -i mykey.pub [path to remote]我收到以下错误:

/usr/local/bin/ssh-copy-id: ERROR: failed to open ID file './mykey': No such file or directory



似乎它没有找到 key ,因为正则表达式正在切断 .pub .我究竟做错了什么?

最佳答案

原来ssh-copy-id检查在与它上传的公钥相同的目录中是否有有效的私钥。

我正在上传其他人的 SSH key ,以便他们可以访问服务器。我的机器上没有他们的私钥,这就是发生错误的原因。

一种选择是手动从脚本中删除该检查,但它正在破解 Homebrew 代码。

我的解决方案是运行 touch mykey使用与我上传的公钥 (mykey.pub) 对应的私钥的文件名语法创建一个空白文件。

关于尝试复制 SSH key 时通过 Homebrew 错误安装 ssh-copy-id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32145510/

相关文章:

ssh - 如何将旧机器的私钥导入新机器?

ssh - zsh 完成 : Disable ssh username completion

git ssh无法访问docker容器中的gitlab

amazon-web-services - Amazon ssh_exchange_identification:读取:连接由对等方重置:更改权限时

git - 我可以使用 SSH URL 检查 git 存储库是否存在吗?

git - 为 Gerrit 和 Hudson 创建 SSH key

git - 克隆 git 存储库时出现 RSA 主机 key 警告

linux - 通过 ssh 执行脚本时无法使用命令 `date` 或 `find`

ruby - 使用 Ruby/Net::SSH 进行远程数据库连接的本地到远程端口转发

sql - 通过 SSH 隧道和 Jump Box 运行 DBT