ssh config file not working as I think the man page describes
I have quite a long ~/.ssh/config file.
I have been trying to rationalise it a bit and share bits that are
common to several systems. So I have two sections referring to a
host that I call 'caracal', the first is:-
#
#
# Mythic Beasts hosting
#
Host mb caracal
HostName caracal.mythic-beasts.com
User chrisisbd
... and at the end of ~/.ssh/config:-
#
#
# Options shared by non-root systems
#
Host cheddar halon caracal mb hostinger oasis41
PermitLocalCommand=yes
LocalCommand rsync --update --delete -a ~/.cfg/ %h:.cfg/
AddKeysToAgent=yes
#
#
# 'global' options
#
Host *
User chris
~
~
So, to my mind when I enter 'ssh caracal' at the command line the user
name used by ssh should be chrisisbd as that's the first value for
User that applies to caracal in the config file. But this isn't what
happens, the user is set to 'chris':-
chris$ ssh caracal
chris@caracal.mythic-beasts.com's password:
The man page for ssh_config says, right at the start: "For each
parameter, the first obtained value will be used.". The caracal entry
in the config file has definitely been found as ssh is trying to
connect to caracal.mythic-beasts.com but the 'User chrisisbd' seems to
be overriden by the 'User chris' at the bottom of the config file.
Surely this isn't what the man page says?
There is also another minor ambiguity that I don't quite understand.
Near the top of the man page for 'Host' is says: "If more than one
pattern is provided, they should be separated by whitespace." but in
'PATTERNS' at the bottom it says: "A pattern-list is a comma-separated
list of patterns."
--
Chris Green
Reply to: