You can do what you describe in the examples using the match spec instead of host . This is another way to specify a host or set of hosts.
For example:
Match user u* host t* Hostname %hest.dev User %r
This will match the user pattern and the target host pattern.
In this case, the command line will look something like ssh u@t , which will lead to such a replacement: u@test.dev .
Here is a snippet from ssh debug output:
debug2: checking match for 'user u* host t*' host t originally t debug3: /Users/_/.ssh/config line 2: matched 'user "u"' debug3: /Users/_/.ssh/config line 2: matched 'host "t"' debug2: match found ... debug1: Connecting to test.dev port 22. debug1: Connection established. ... u@test.dev password:
match may coincide with a couple of other things (and it is possible to execute a shell command), but otherwise it is the same as host . The ssh client parameters specified there are the same (for example, you can specify the IdentityFile , which will be used with the corresponding specification)
You can read more on the manual page: ssh_config
kln
source share