ssh 配置主机限制

esw*_*ues 3 ssh configuration config line

我有一个问题,~/.ssh/config. 我有 300 台主机,我需要以 root 身份而不是我的身份。我编写了为我创建配置文件的脚本,它为我提供了包含四行的配置文件:

host *
    user me
host <here 300 hostnames seperated by space and in this same line all>
    user root
Run Code Online (Sandbox Code Playgroud)

当我想通过 ssh 连接到任何服务器时,我收到消息,我有一个“第 10 行配置错误”或“...第 6 行”:/

wc -l .ssh/config
Run Code Online (Sandbox Code Playgroud)

给我 4

Jak*_*uje 5

当前的 OpenSSH 应该读取最多4096字节长的行。但 OpenSSH 7.5 之前的版本只能读取 1024 字节,这可能还不够(提交)。

你有两种可能性:

  • 更新至 OpenSSH 7.5
  • 例如,将行剥离为不超过 1024 个字符的较短行

    host <here first 100 hostnames seperated by space and in this same line all>
            user root
        host <here another 100 hostnames ...>
            user root
        host <here another 100 hostnames ...>
            user root
    
    Run Code Online (Sandbox Code Playgroud)