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
    • 最新
    • 标签
主页 / server / 问题

问题[known-hosts](server)

Martin Hope
Alex
Asked: 2022-04-07 01:54:06 +0800 CST

如何修复一次又一次弹出的冒犯性关键短语?

  • 0

对于 github 存储库,我想更新它并输入

git fetch --all

在命令行上,但我总是被问到

Warning: the ECDSA host key for 'xxx.yyy' differs from the key for the IP address '123.456.789.000'
Offending key for IP in /etc/ssh/ssh_known_hosts:1042
Matching host key in /home/adietz/.ssh/known_hosts:1
Are you sure you want to continue connecting (yes/no)? 

我发现类似的问题与从文件中删除违规行的解决方案

.ssh/known_host

但是只要我重复该git命令,就会再次添加该行.ssh/known_host,并且一遍又一遍地询问我。.ssh/known_host我什至没有运气就删除了完整的文件。

每次我仍然被问到是/否的问题。

有什么办法可以摆脱这种烦恼吗?Ubuntu 20.04.4

ubuntu ssh known-hosts
  • 1 个回答
  • 92 Views
Martin Hope
Clint Laskowski
Asked: 2022-01-30 07:40:34 +0800 CST

为什么 SSH 认为我还有一个 'known_hosts2' 文件?

  • 3

在尝试清理 iMac (macOS Monterey 12.1) 上的 SSH 配置和密钥文件时,我尝试使用详细标志 (-v) 进行 SSH。这生成的输出包括以下几行:

...
debug1: load_hostkeys: fopen /Users/clint/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
...

我知道我试图创建我的 known_hosts 文件的备份(并将其称为“known_hosts2”),但我已经删除了它。

有谁知道我如何找出为什么 SSH 仍然引用(并且认为我有)一个名为“known_hosts2”的旧文件?

谢谢!

mac-osx ssh known-hosts
  • 2 个回答
  • 2511 Views
Martin Hope
A L
Asked: 2021-08-21 13:18:47 +0800 CST

ssh-keyscan 到 known_hosts 不产生任何结果

  • 0

当我执行时:

ssh-keyscan -H 172.22.56.2

我得到以下输出:

# 172.22.56.2:22 SSH-2.0-RomSShell_4.31
# 172.22.56.2:22 SSH-2.0-RomSShell_4.31
# 172.22.56.2:22 SSH-2.0-RomSShell_4.31
# 172.22.56.2:22 SSH-2.0-RomSShell_4.31
# 172.22.56.2:22 SSH-2.0-RomSShell_4.31

如果我再尝试:

ssh-keyscan -H 172.22.56.2 >> ~/.ssh/known_hosts

不熟悉 ssh-keyscan 但相信我得到的输出..不是我想要的,我还尝试了 -t 的变体,例如:

ssh-keyscan -H -t rsa 172.22.56.2 >> ~/.ssh/known_hosts

所有的结果都是一样的。该文件的权限是:

-rw-r--r-- 1 username username 886

“用户名”是运行上述命令的用户名。这给我留下了以下问题:

  1. 我的 ssh-keyscan 输出传达/意思是什么?我希望这里有 |1|weofijgojw = sshkey 字符串。
  2. 为什么无论如何都没有写入 ~/.ssh/known_hosts ?没有任何迹象表明问题已反馈给我/命令需要

提前感谢您的任何见解!

更新 1:

user@hostname:~$ ssh user@172.22.56.2
Unable to negotiate with 172.22.56.2 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

user@hostname:~$ ssh user@172.22.56.2 -oKexAlgorithms=+diffie-hellman-group1-sha1
Unable to negotiate with 172.22.56.2 port 22: no matching host key type found. Their offer: ssh-dss

user@hostname:~$ ssh user@172.22.56.2 -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-dss
Unable to negotiate with 172.22.56.2 port 22: no matching cipher found. Their offer: 3des-cbc

user@hostname:~$ ssh user@172.22.56.2 -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-dss -oCiphers=+3des-cbc

The authenticity of host '172.22.56.2 (172.22.56.2)' can't be established.
DSA key fingerprint is SHA256:HwdMfb3k5KwrwQkFIRe6ZXilbObYhNzLbwb0zvk2n8U.
Are you sure you want to continue connecting (yes/no/[fingerprint])? ^C

user@hostname:~$ ssh-keyscan -H 172.22.56.2
# 172.22.56.2:22 SSH-2.0-RomSShell_4.31
# 172.22.56.2:22 SSH-2.0-RomSShell_4.31
# 172.22.56.2:22 SSH-2.0-RomSShell_4.31
# 172.22.56.2:22 SSH-2.0-RomSShell_4.31
# 172.22.56.2:22 SSH-2.0-RomSShell_4.31

添加“-vv”仅适用于 ssh 应用程序,而不适用于 ssh-keyscan,所以我没有从中找到任何有用的东西。

从技术上讲,最初提出的问题得到了回答,但这更多是因为我对调查缺乏完整的愿景——在这一点上,真正的问题似乎是:

  • 当 ssh 到同一主机产生 SSH 密钥提示时,为什么 ssh-keyscan 不返回任何结果?

我应该打开一个新问题还是只是更改我原来的提交?谢谢!

ssh ubuntu-20.04 known-hosts
  • 1 个回答
  • 1670 Views
Martin Hope
Robert
Asked: 2021-05-29 06:17:40 +0800 CST

我可以将 SSH known_hosts 设置为忽略特定的主机名吗?

  • 2

我最近使用 Raspbian 系统映像设置了一些无头 Raspberry Pi 系统。他们默认使用 zeroconf 域名raspberrypi.local。在我更改它之前,我必须使用 SSH 连接到新服务器,它总是对我咆哮:

> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> @      WARNING: POSSIBLE DNS SPOOFING DETECTED!           @
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

并且在我打开 known_hosts 文件并删除上一个条目之前不会连接。然后当它连接时,它会自动添加一个新条目,raspberrypi.local以便下次搞砸。

我理解并欣赏检查密钥并自动添加新密钥的逻辑,但我认为对于这种特定情况它没有意义。我永远不会连接到一个名为的服务器raspberrypi.local,除非它是我刚刚插入的新服务器,在这种情况下,它永远不会有一个已知的可信密钥。

我可以从known_hosts 规范中看到,我可以在地址端设置一个通配符(即,从这个范围内的任何地址接受这个密钥)但我想要做的是在密钥端设置一个通配符(接受来自这个的任何密钥特定域名)。或者更好的是,根本不检查来自该域名的密钥。

有没有办法告诉 known_hosts 忽略(通过而不检查密钥)单个特定域名?

ssh known-hosts
  • 1 个回答
  • 966 Views
Martin Hope
Felix Schwarz
Asked: 2016-04-19 23:38:11 +0800 CST

OpenSSH 将 <IPv6>%2 添加到 known_hosts

  • 2

当我使用 IPv6 连接到 CentOS 7 主机时,我的 ssh 客户端总是添加<IPv6 host addr>%2到,known_hosts即使该主机的主机密钥(带有主机的 IPv6 地址)已经存在于known_hosts.

代表什么%2?我正在使用来自 CentOS 7 的未经修改的 OpenSSH,它是版本 6.6.1p1-25,版本 25.el7_2。

更新:评论提到名称解析是一个可能的问题。事实上,我在客户端机器上使用 systemd-resolved 。当我resolved从/etc/nsswitch.conf(hosts选项)中删除时,问题不再发生。这是与systemd-resolved-219-19.el7_2.7.x86_64)。

更新(2017 年 2 月):我刚刚注意到systemd 解决的错误 4465,所以我注意到的行为是/只是一个错误,将在更高版本的 systemd 中修复。

ssh ipv6 systemd ssh-keys known-hosts
  • 1 个回答
  • 973 Views
Martin Hope
gareth_bowles
Asked: 2010-04-16 20:15:11 +0800 CST

我可以自动将新主机添加到 known_hosts 吗?

  • 318

这是我的情况:我正在设置一个测试工具,它将从中央客户端启动许多虚拟机实例,然后通过ssh. 虚拟机将具有以前未使用的主机名和 IP 地址,因此它们不会出现在~/.ssh/known_hosts中央客户端的文件中。

我遇到的问题是ssh针对新虚拟实例运行的第一个命令总是会出现交互式提示:

The authenticity of host '[hostname] ([IP address])' can't be established.
RSA key fingerprint is [key fingerprint].
Are you sure you want to continue connecting (yes/no)?

有没有一种方法可以绕过这个并让客户端机器已经知道新主机,也许是通过使用已经烘焙到虚拟机映像中的公钥?如果可以的话,我真的很想避免使用 Expect 或其他任何东西来回答交互式提示。

linux ssh known-hosts
  • 24 个回答
  • 490112 Views
Martin Hope
cjs
Asked: 2009-07-08 00:17:56 +0800 CST

从 OpenSSH known_hosts 文件条目生成 SSHFP 记录

  • 1

我有一个来自 OpenSSHknown_hosts文件的条目;我想为此生成一个 SSHFP 资源记录。我可以ssh-keygen毫无困难地使用它来生成指纹:

$ ssh-keygen -f foo_known_host -l
1040 09:a0:5c:5f:43:fb:e5:25:d8:0c:d8:dc:d7:7a:c4:62 foo.example.com. (RSA)

但它似乎不喜欢 DNS 指纹记录:

$  ssh-keygen -f foo_known_host -r foo
failed to read v2 public key from foo_known_host.

那么我该怎么做呢?


注意:如果您是通过询问搜索引擎如何从远程主机生成 SSHFP 记录(而不是上述指纹的本地副本)来到这里的,那么可以通过ssh-keyscan -D machine.name –.

ssh known-hosts
  • 3 个回答
  • 2245 Views

Sidebar

Stats

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

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve