Sample Header Ad - 728x90

What is the difference between a Match all and a Host * block in ssh_config

2 votes
0 answers
968 views
As I was reviewing my current OpenSSH client configuration file and intensively reading the ssh_config(5) man page, I found that, from my understanding, both Match all and Host * will achieve the same result. Thus I was wondering if the fact that they cover the same need is a side effect of other usage for both Match and Host block, or if there are subtle differences between the two? Edit: After reading the answer to the question (https://unix.stackexchange.com/questions/741771/in-ssh-config-what-does-match-canonical-all-mean) (thank you @muru for your proposal), I still have some doupt: In it, @BlockchainOffice first say that: > The Match all block matches all hosts and is equivalent to Host *. I understand that as "they can be used in the exact same way". However, later he adds: > How is Match All different to Host *? > > Host * matches all hosts, thus the configuration directives that follow will be applied to all hosts. The hostname can appear anywhere in the pattern you use (either as part of the pattern itself, or at the end after an asterisk). > > A "Match All" keyword is used to group all the configuration directives that apply to a particular host. When you use "Match All", you don't need to specify a pattern, as it will match all hosts by default. And now I’m a bit lost. The two paragraphs seems to say they are different, but I don’t understand how. Mainly I don’t get the "The hostname can appear anywhere in the pattern you use (either as part of the pattern itself, or at the end after an asterisk)." about the Host *. I’m not sure what the hostname here is refering to and how it can appears in the pattern (what pattern?) or after the asterisk.
Asked by Étienne (21 rep)
Jun 16, 2023, 11:32 AM
Last activity: Jun 16, 2023, 09:37 PM