AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 698997
Accepted
Alexander Zeitler
Alexander Zeitler
Asked: 2015-11-17 20:43:22 +0800 CST2015-11-17 20:43:22 +0800 CST 2015-11-17 20:43:22 +0800 CST

key_load_public:在 Ubuntu 15.10 上使用 scp 或 git clone 的无效格式

  • 772

全新安装 Ubuntu 15.10 后,在使用scpor时git clone,我收到以下警告(命令本身不会失败):key_load_public: invalid format

我怎样才能摆脱这个警告?

更新:这是输出scp -vvv:

OpenSSH_6.9p1 Ubuntu-2, OpenSSL 1.0.2d 9 Jul 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to ... [...] port 22.
debug1: Connection established.
key_load_public: invalid format
debug1: identity file /home/alexzeitler/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/alexzeitler/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9p1 Ubuntu-2
15.10
  • 2 2 个回答
  • 61196 Views

2 个回答

  • Voted
  1. Best Answer
    Jakuje
    2015-11-20T13:13:06+08:002015-11-20T13:13:06+08:00

    检查文件/Users/alexzeitler/.ssh/id_rsa。还有什么?它是怎么到那里的?

    它应该是您的 RSA 私钥,不是吗?里面有东西/Users/alexzeitler/.ssh/id_rsa.pub吗?它是有效的公钥吗?

    如果您不使用这些键,将它们都删除,消息就会消失。如果您以不同的方式使用它们,请将它们移到其他地方。如果它们采用不同的格式,则相同。

    公共部分可能已损坏,因此您可以使用以下命令从私有部分重新创建它:

    ssh-keygen -f ~/.ssh/id_rsa -y > ~/.ssh/id_rsa.pub
    

    ###hostkeys 可能性另一种可能性是客户端正在尝试读取服务器公钥HostBasedAuthentication。你不允许它进来/etc/ssh/ssh_config吗?

    这将是这些文件之一丢失或损坏:

    /etc/ssh/ssh_host_ecdsa_key.pub
    /etc/ssh/ssh_host_ed25519_key.pub
    /etc/ssh/ssh_host_dsa_key.pub
    /etc/ssh/ssh_host_rsa_key.pub
    

    您的sshd服务器没有抱怨?

    • 35
  2. questionto42standswithUkraine
    2021-04-29T08:34:26+08:002021-04-29T08:34:26+08:00

    Load key "/root/.ssh/id_rsa": invalid format我在 Dockerfile 中尝试时遇到了类似的错误:

    RUN echo "$ssh_prv_key" > /root/.ssh/id_rsa &&     chmod 600 /root/.ssh/id_rsa
    

    这导致了像identity file /root/.ssh/id_rsa type -1 invalid format和这样的错误read_passphrase: can't open /dev/tty。不要echo "${SSH_PRIVATE_KEY}" >> /root/.ssh/id_rsa用来传递私钥!

    正确的方法是使用

    COPY id_rsa /root/.ssh/id_rsa
    RUN chmod 600 /root/.ssh/id_rsa
    

    解决方案说明:我的私钥格式错误 - 而不是很多行,它作为一行传递,并且您可能有任何其他格式问题,例如在开头或结尾忘记了“-”,或者在行尾,例如缺失的换行格式或行尾的附加字母。

    请参阅Dockerfile:使用无密码私钥克隆存储库。Errors: “authentication agent” or “read_passphrase: can't open /dev/tty”了解更多细节,其主要思想来自Add private key to ssh-agent in docker file,其思想再次来自Gitlab CI/Docker: ssh-add 一直要求输入密码。

    • 0

相关问题

  • Ubuntu 15.10 MD5 校验和在哪里?

  • 如何在 freedesktop 服务中使用刷新命令?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve