Bug 2031

Summary: ssh config parser ignores host-specific overrides after wildcard.
Product: Portable OpenSSH Reporter: Richard Neill <openssh>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED WORKSFORME    
Severity: minor CC: dtucker
Priority: P5    
Version: 5.9p1   
Hardware: amd64   
OS: Linux   

Description Richard Neill 2012-08-09 04:22:04 AEST
My (simplified) .ssh/config file contains:

------
Host *
   [Default opts]
   ForwardX11 yes

Host galaxy
    User root
    ForwardX11 no
------

If I then run "ssh -v galaxy", it correctly shows that it is picking up the "root" option, but it is failing to pick up the host-specific override to turn off ForwardX11.

(What I have is a system-wide default to no X11 Forward, a personal default for X11 forwarding, and a single host which shouldn't do X11 forwarding)


A very careful reading of the man page suggests that this may not, strictly-speaking, be a bug, but I don't think it's doing what the  user intends either. In my view, later options should override earlier options, rather than being ignored. 

P.S. Thanks for your time, and a really useful program.
Comment 1 Darren Tucker 2012-08-09 09:18:06 AEST
This is by design: you can put overrides at the top and defaults at the bottom.  From the second paragraph of ssh_config(5):

"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."

Sorry, but's worked this way for over a decade and I don't see it changing now, especially given it'll possibly break existing working configs.
Comment 2 Richard Neill 2012-08-09 11:22:18 AEST
Oh dear oh dear, no points at all for my reading comprehension! 
Sorry for the erroneous report.
Comment 3 Damien Miller 2015-08-11 23:02:35 AEST
Set all RESOLVED bugs to CLOSED with release of OpenSSH 7.1