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 / 问题 / 943774
Accepted
stone.212
stone.212
Asked: 2018-12-11 20:33:52 +0800 CST2018-12-11 20:33:52 +0800 CST 2018-12-11 20:33:52 +0800 CST

ssh-keyscan 不读取 .ssh/config?

  • 772

我ssh-keyscan在 shell 脚本中使用来接受主机的密钥。主机由主机名标识,但不在 /etc/hosts 中。他们在,./ssh/config所以我可以ssh <hostname>,但我不能ping等等。

看起来ssh-keyscan没有使用该.ssh/config文件,这看起来很有趣。

有人可以确认这发生在他们身上吗?

真正的问题:有人有办法让 ssh-keyscan 使用 ~/.ssh/config 吗?

ssh
  • 2 2 个回答
  • 1733 Views

2 个回答

  • Voted
  1. Best Answer
    jplitza
    2019-09-04T00:10:09+08:002019-09-04T00:10:09+08:00

    ssh-keyscan 没有也不能使用.ssh/config.

    但是,您所要求的并不要求它这样做:只需将真实主机名/地址传递给 ssh-keyscan(并将它们存储在 known_hosts 中)即可,即使您使用配置中的别名ssh。但是您甚至可以指示 ssh-keyscan 将其他名称添加到输出中,而不是使用该-f选项时用于连接的名称:

     -f file
             Read hosts or “addrlist namelist” pairs from file, one per line.
             If - is supplied instead of a filename, ssh-keyscan will read
             hosts or “addrlist namelist” pairs from the standard input.
    
    • 2
  2. asktyagi
    2019-09-04T00:32:10+08:002019-09-04T00:32:10+08:00

    ssh-keyscan 是一个用于收集多个主机的公共 ssh 主机密钥的实用程序。它旨在帮助构建和验证**ssh_known_hosts**文件。ssh-keyscan 提供了一个适合 shell 和 perl 脚本使用的最小接口。

    -f file
    Read hosts or addrlist namelist pairs from this file, one per line. If - is supplied instead of a filename, ssh-keyscan will read hosts or addrlist namelist pairs from the standard input.
    
    
    Input format: 
    1.2.3.4,1.2.4.4 name.my.domain,name,n.my.domain,n,1.2.3.4,1.2.4.4
    
    Output format for rsa1 keys:
    host-or-namelist bits exponent modulus
    
    Output format for rsa and dsa keys:
    host-or-namelist keytype base64-encoded-key
    
    Where keytype is either ''ssh-rsa'' or ''ssh-dss''.
    /etc/ssh/ssh_known_hosts 
    

    例如:

    Print the rsa host key for machine hostname:
    $ ssh-keyscan hostname
    
    Find all hosts from the file ssh_hosts which have new or different keys from those in the sorted file ssh_known_hosts:
    $ ssh-keyscan -t rsa,dsa -f ssh_hosts | sort -u - ssh_known_hosts | diff ssh_known_hosts - 
    
    • 0

相关问题

  • 如何最好地设置 ssh 隧道以访问远程网络 (Linux)

  • SSH 和重定向

  • 通过 SSH 会话使用 NET USER 命令拒绝访问

  • SSH 服务器零日漏洞利用 - 保护自己的建议

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

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