Skip to content

文中关于 ssh 客户端配置文件的 Host * 设置的论述存在问题 #34

Closed

Description

@Borne912

文章的这个部分,具体如下图所示:

如上图所示,Host * 如果写在了 Host remoteserver 前面,就无法实现像文中所说的后续覆盖的效果了,因为:

官方文档指出:For each parameter, the first obtained value will be used.(对于每个参数,将使用第一个获得的值)

当 Host * 写在前面时,Port 2222 会被首先使用,下面在补充一个 ssh 连接的过程:

综上所述,要实现文章中所说的写法,应该这样写:

Host remoteserver
     HostName remote.example.com
     User neo
     Port 2112

Host *
     Port 2222

即:Host * 应该被放到配置文件的最末尾,进行补充设置。

Activity

  1. ruanyf commented on Sep 5, 2023

    @ruanyf
    Contributor

    谢谢指出,已经改正了。

  2. added a commit that references this issue on Aug 24, 2024
    6fd25d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions