为什么git忽略/ etc / ssh / ssh_known_hosts中的SSH密钥?

用户

我已将github.comSSH密钥添加/etc/ssh/ssh_known_hosts但是当我跑步时

git clone [email protected]:me/repo

我仍然得到

Cloning into 'repo'...
The authenticity of host 'github.com (XXX.XXX.XXX.XXX)' can't be established.
RSA key fingerprint is SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
Are you sure you want to continue connecting (yes/no)?
  • 如果我将密钥添加到~/.ssh/known_hosts它按预期方式工作,则无提示。
  • 我在debian机器上运行它。
  • 我希望这可以直接使用文件,/etc/ssh/ssh_known_hosts因为有多个用户。
  • 我也不能打字'yes',因为它正在运行puppet
  • 出于安全原因,我们不能使用StrictHostKeyChecking = no
  • 我没有~/.ssh/config文件。
  • (编辑)sshd自修改以来,我也已重新启动/etc/ssh/ssh_known_hosts

如何强制git使用/etc/ssh/ssh_known_hosts

编辑1:

这是文件/etc/ssh/ssh_config(并且~/.ssh/config不存在):

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

Host *
#   ForwardAgent no
#   ForwardX11 no
#   ForwardX11Trusted yes
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   IdentityFile ~/.ssh/id_ecdsa
#   IdentityFile ~/.ssh/id_ed25519
#   Port 22
#   Protocol 2
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes

这是我的/etc/ssh/ssh_known_hosts

# HEADER: This file was autogenerated at 2020-12-31 10:33:06 +0000
# HEADER: by puppet.  While it can still be managed manually, it
# HEADER: is definitely not recommended.
gerrit.wikimedia.org ssh-rsa AAAAB3Nz[...]
github ssh-rsa AAAAB3NzAAAAB3Nz[...]

编辑2:

所有人都具有以下权限/etc/ssh/ssh_known_hosts

vagrant@vagrant:~$ ls -la /etc/ssh/ssh_known_hosts 
-rw-r--r-- 1 root root 795 Dec 31 10:33 /etc/ssh/ssh_known_hosts
bk2204

您的已知主机文件格式错误。每行的第一个条目是您要连接的系统的名称。在这种情况下,这必须github.com不是普通的github这是OpenSSH用于查找适当密钥的技术。

您可以使用找到正确的格式ssh-keyscan github.com

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

为什么SSH不参考/ etc / hosts?

来自分类Dev

为什么“ssh-keygen -R”不从 ~/.ssh/known_hosts 中删除主机

来自分类Dev

/ etc / ssh /和〜/ .ssh有什么区别?

来自分类Dev

Github SSH密钥被忽略

来自分类Dev

为什么ssh忽略了〜/ .ssh / config?无法提交到github

来自分类Dev

在〜/ .ssh / config主机名和/ etc / hosts之间发生冲突时,优先处理什么?

来自分类Dev

为什么TZ通常不在/ etc / ssh / sshd_config的AcceptEnv中列出

来自分类Dev

为什么git push不能选择正确的ssh密钥?

来自分类Dev

为什么在使用sudo运行时ssh为什么在/root/.ssh中查找密钥?

来自分类Dev

如何在/ etc / ssh中还原ssh_config文件

来自分类Dev

为什么文件夹中没有ssh密钥?

来自分类Dev

为什么在通过ssh登录时未获得/ etc / default / locale的信息?

来自分类Dev

为什么 /etc/profile.d 只在 SSH 登录时使用?

来自分类Dev

为什么将读取权限递归添加到 /etc 会破坏 ssh?

来自分类Dev

无法加载主机密钥:/ etc / ssh_host _ * _ key

来自分类Dev

无法加载主机密钥:/var/log/auth.log中的/ etc / ssh / ssh_host_ed25519_key

来自分类Dev

为什么ssh忽略用户配置文件

来自分类Dev

bash像/ etc / hosts文件一样在zsh shell中对ssh命令进行自动补全?

来自分类Dev

Chrome为什么会忽略OS X上的/ etc / hosts?

来自分类Dev

/etc/ssh/ssh_host_rsa_key.pub不是公共密钥文件

来自分类Dev

如何使ssh忽略.ssh / config?

来自分类Dev

如何使ssh忽略.ssh / config?

来自分类Dev

ssh忽略ssh-agent

来自分类Dev

Terraform Lifecycle忽略元数据中的SSH密钥

来自分类Dev

为什么ssh无法在.ssh / config中扩展%h变量?

来自分类Dev

为什么在Ubuntu 16.04中忽略/etc/init/tty?.conf?

来自分类Dev

如何基于给定的ssh密钥限制git SSH访问

来自分类Dev

避免〜/ .ssh / known_hosts中的重复条目

来自分类Dev

是否确定.ssh / known_hosts中的条目?

Related 相关文章

  1. 1

    为什么SSH不参考/ etc / hosts?

  2. 2

    为什么“ssh-keygen -R”不从 ~/.ssh/known_hosts 中删除主机

  3. 3

    / etc / ssh /和〜/ .ssh有什么区别?

  4. 4

    Github SSH密钥被忽略

  5. 5

    为什么ssh忽略了〜/ .ssh / config?无法提交到github

  6. 6

    在〜/ .ssh / config主机名和/ etc / hosts之间发生冲突时,优先处理什么?

  7. 7

    为什么TZ通常不在/ etc / ssh / sshd_config的AcceptEnv中列出

  8. 8

    为什么git push不能选择正确的ssh密钥?

  9. 9

    为什么在使用sudo运行时ssh为什么在/root/.ssh中查找密钥?

  10. 10

    如何在/ etc / ssh中还原ssh_config文件

  11. 11

    为什么文件夹中没有ssh密钥?

  12. 12

    为什么在通过ssh登录时未获得/ etc / default / locale的信息?

  13. 13

    为什么 /etc/profile.d 只在 SSH 登录时使用?

  14. 14

    为什么将读取权限递归添加到 /etc 会破坏 ssh?

  15. 15

    无法加载主机密钥:/ etc / ssh_host _ * _ key

  16. 16

    无法加载主机密钥:/var/log/auth.log中的/ etc / ssh / ssh_host_ed25519_key

  17. 17

    为什么ssh忽略用户配置文件

  18. 18

    bash像/ etc / hosts文件一样在zsh shell中对ssh命令进行自动补全?

  19. 19

    Chrome为什么会忽略OS X上的/ etc / hosts?

  20. 20

    /etc/ssh/ssh_host_rsa_key.pub不是公共密钥文件

  21. 21

    如何使ssh忽略.ssh / config?

  22. 22

    如何使ssh忽略.ssh / config?

  23. 23

    ssh忽略ssh-agent

  24. 24

    Terraform Lifecycle忽略元数据中的SSH密钥

  25. 25

    为什么ssh无法在.ssh / config中扩展%h变量?

  26. 26

    为什么在Ubuntu 16.04中忽略/etc/init/tty?.conf?

  27. 27

    如何基于给定的ssh密钥限制git SSH访问

  28. 28

    避免〜/ .ssh / known_hosts中的重复条目

  29. 29

    是否确定.ssh / known_hosts中的条目?

热门标签

归档