Skip to main content
Fix the timeout option.
Source Link
Stephen Kitt
  • 480.9k
  • 59
  • 1.2k
  • 1.4k

I'm using like this.

Match host mycomputer exec "nc -Gw 1 -z 192.168.1.11 %p"
    HostName 192.168.1.11
Match host mycomputer # fallback
    HostName my.no-ip.dynamic
Host mycomputer
    # ... other configs

Host not-my-computer
# ... other configs

ssh_config doesn't have something like indentation block. If you want to limit match sentence to a specific host, then you should describe the full condition.

You can avoid long awaiting nc by giving it -Gw 1 (connection timeout 1s) option, and you can utilize following behaviour to avoid multiple invocation of nc

Match
Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file. If a keyword appears in multiple Match blocks that are satisfied, only the first instance of the keyword is applied.

https://www.freebsd.org/cgi/man.cgi?sshd_config(5)

I'm using like this.

Match host mycomputer exec "nc -G 1 -z 192.168.1.11 %p"
    HostName 192.168.1.11
Match host mycomputer # fallback
    HostName my.no-ip.dynamic
Host mycomputer
    # ... other configs

Host not-my-computer
# ... other configs

ssh_config doesn't have something like indentation block. If you want to limit match sentence to a specific host, then you should describe the full condition.

You can avoid long awaiting nc by giving it -G 1 (connection timeout 1s) option, and you can utilize following behaviour to avoid multiple invocation of nc

Match
Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file. If a keyword appears in multiple Match blocks that are satisfied, only the first instance of the keyword is applied.

https://www.freebsd.org/cgi/man.cgi?sshd_config(5)

I'm using like this.

Match host mycomputer exec "nc -w 1 -z 192.168.1.11 %p"
    HostName 192.168.1.11
Match host mycomputer # fallback
    HostName my.no-ip.dynamic
Host mycomputer
    # ... other configs

Host not-my-computer
# ... other configs

ssh_config doesn't have something like indentation block. If you want to limit match sentence to a specific host, then you should describe the full condition.

You can avoid long awaiting nc by giving it -w 1 (connection timeout 1s) option, and you can utilize following behaviour to avoid multiple invocation of nc

Match
Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file. If a keyword appears in multiple Match blocks that are satisfied, only the first instance of the keyword is applied.

https://www.freebsd.org/cgi/man.cgi?sshd_config(5)

Source Link

I'm using like this.

Match host mycomputer exec "nc -G 1 -z 192.168.1.11 %p"
    HostName 192.168.1.11
Match host mycomputer # fallback
    HostName my.no-ip.dynamic
Host mycomputer
    # ... other configs

Host not-my-computer
# ... other configs

ssh_config doesn't have something like indentation block. If you want to limit match sentence to a specific host, then you should describe the full condition.

You can avoid long awaiting nc by giving it -G 1 (connection timeout 1s) option, and you can utilize following behaviour to avoid multiple invocation of nc

Match
Introduces a conditional block. If all of the criteria on the Match line are satisfied, the keywords on the following lines override those set in the global section of the config file, until either another Match line or the end of the file. If a keyword appears in multiple Match blocks that are satisfied, only the first instance of the keyword is applied.

https://www.freebsd.org/cgi/man.cgi?sshd_config(5)