RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题 / 1146240
Accepted
bearpro
bearpro
Asked:2020-06-27 17:36:37 +0000 UTC2020-06-27 17:36:37 +0000 UTC 2020-06-27 17:36:37 +0000 UTC

使用密钥通过 ssh 连接时失败的原因是什么?

  • 772

我正在尝试使用 ssh 自动将 Web 应用程序交付到服务器。

在服务器上,我创建了一个单独的 Linux 用户并代表它运行 ssh-keygen 命令。
然后我将私钥复制到我的计算机并运行命令

ssh -i id_rsa -oBatchMode=yes -v github-deployer@<ip сервера>

我得到一个错误Permission denied (publickey,password)
同时,服务器配置没有问题,我可以代表另一个用户轻松连接,尽管我以不同的方式生成了密钥(我在我的计算机上生成并上传了服务器的公钥)。

在文件/var/log/auth.log中,当我尝试连接时,我只看到一行:

Jun 27 12:28:07 seterator sshd[20567]: Connection reset by 46.242.39.189 port 64510 [preauth]

使用 -v 开关运行 ssh 客户端时,输出如下:

debug1: Reading configuration data C:\\Users\\m.prokazin/.ssh/config
debug1: Connecting to <ip сервера> [<ip сервера>] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\m.prokazin\\Documents\\tmp\\key type 0  # <- это реальный путь к файлу приватного ключа
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\m.prokazin\\Documents\\tmp\\key-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u7
debug1: match: OpenSSH_7.4p1 Debian-10+deb9u7 pat OpenSSH* compat 0x04000000
debug1: Authenticating to <ip сервера>:22 as 'github-deployer'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:g30wkiuNuaw6RZVbq0F0EsRyA1Gw8vbHfNruCF7iAS0
debug1: Host '<ip сервера>' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\m.prokazin/.ssh/known_hosts:41
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:lvQ7LKb8X8XS/Gx5TmsldZ+aqwyAl6teujJB+dTBaYI C:\\Users\\m.prokazin\\Documents\\tmp\\key
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
github-deployer@<ip сервера>: Permission denied (publickey,password).

这整个情况也在我按计划连接以上传更新的机器上重现。

可能是什么问题呢?

windows
  • 1 1 个回答
  • 10 Views

1 个回答

  • Voted
  1. Best Answer
    Vladislav Tikhomirov
    2020-06-27T18:58:37Z2020-06-27T18:58:37Z
    • 密钥在客户端生成,公钥已经上传到服务器
    • 检查是否authorized_keys在服务器上输入了公钥
    • 检查您是否已将密钥扔到客户端~/.ssh
    • 检查私钥权限
    • 2

相关问题

  • bat文件中的简单循环,键盘输入,比较。程序无法正常工作

  • 如何在没有 fn 的情况下删除按钮的工作?

  • OpenVPN 路由

  • CMD 换行符输入到控制台

  • 帮助编写声卡驱动程序

  • Windows 10 返回对注册表分支的访问权限

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    如何从列表中打印最大元素(str 类型)的长度?

    • 2 个回答
  • Marko Smith

    如何在 PyQT5 中清除 QFrame 的内容

    • 1 个回答
  • Marko Smith

    如何将具有特定字符的字符串拆分为两个不同的列表?

    • 2 个回答
  • Marko Smith

    导航栏活动元素

    • 1 个回答
  • Marko Smith

    是否可以将文本放入数组中?[关闭]

    • 1 个回答
  • Marko Smith

    如何一次用多个分隔符拆分字符串?

    • 1 个回答
  • Marko Smith

    如何通过 ClassPath 创建 InputStream?

    • 2 个回答
  • Marko Smith

    在一个查询中连接多个表

    • 1 个回答
  • Marko Smith

    对列表列表中的所有值求和

    • 3 个回答
  • Marko Smith

    如何对齐 string.Format 中的列?

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

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

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5