For each directive, the first relevant occurrence in the ssh_config
is used.
Quoting man page for ssh_config
:
Since the first obtained value for each parameter is used, more host-specific declarations should be given near the beginning of the file, and general defaults at the end.
So with the configuration file below:
- For all hosts,
ServerAliveInterval 1
is always used,4
is never used. ConnectTimeout
is2
forwork
, for other hosts it's3
,ConnectTimeout 8
is never used.- For all hosts, the
ServerAliveCountMax
is5
, thework
-specific value6
is never used, not even forwork
.
ServerAliveInterval 1
Host work
ConnectTimeout 2
Host *
ConnectTimeout 3
ServerAliveInterval 4
ServerAliveCountMax 5
Host work
ServerAliveCountMax 6
ServerAliveInterval 7
ConnectTimeout 8