gpt4 book ai didi

ssh - 从服务器获取指纹

转载 作者:行者123 更新时间:2023-12-02 14:13:54 28 4
gpt4 key购买 nike

如果我只有服务器的 IP 地址并且服务器未在我的 ~/.ssh/known_hosts 中列出,如何从服务器获取 SSH 指纹文件?

我想看看一些主机 key 。这是我在 Ruby 中尝试过的:

net_ssh_session =
Net::SSH::Transport::Session.new(
target, :port => port, :timeout => timeout, :paranoid => Net::SSH::Verifiers::Null.new)
host_keys = net_ssh_session.host_keys

如果服务器未在我的 ~/.ssh/known_hosts 中列出,我无法获得任何主机 key .

最佳答案

引用我文章的重要部分Where do I get SSH host key fingerprint to authorize the server?

You should get an SSH host key fingerprint along with your credentials from a server administrator. Knowing the host key fingerprint and thus being able to verify it is an integral part of securing an SSH connection. It prevents man-in-the-middle attacks.

In the real world, most administrators do not provide the host key fingerprint.

Instead you can ask anyone else who has a physical access to the server or who already knows the host key. The host key is only one and hence the same for all users. Also note that the host key fingerprint is generated from a public key part of the host key only. So it is not secret and can be safely sent over an unencrypted (yet trusted) communication channels.

If you do not have anyone else to obtain the fingerprint from, you may need to connect to the server without knowing the fingerprint. Before connecting for the first time, ensure a security of your local machine and a line to the server. For example if you plan to connect to the server from an external site (e.g. from home or a client), but you have a physical access to the server site, connect from the server site the first time (e.g. your workplace).

关于ssh - 从服务器获取指纹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40189430/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com