Bug 3236 - multiple Subsystem options in sshd_config prevent sshd from starting
Summary: multiple Subsystem options in sshd_config prevent sshd from starting
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 8.4p1
Hardware: Other Linux
: P5 enhancement
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-30 19:16 AEDT by Jakub Jelen
Modified: 2022-05-09 09:48 AEST (History)
7 users (show)

See Also:


Attachments
Make repeated Subsystem directives non-fatal (1.04 KB, patch)
2022-05-09 09:48 AEST, Damien Miller
djm: ok? (dtucker)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelen 2020-11-30 19:16:11 AEDT
All of the other configuration options are just ignored, if specified repetitively, but Subystem will prevent sshd from starting. This is unexpected and undocumented in manual page and something that might become more common issue with the Include support.

I would like to suggest this option would behave same as all the others, maybe downgrading the log level of the message.

The other option would be to document it in the manual page that the same subsystem can not repeat (yet another exception from configuration parsing rules).

Reproducer:

# echo "Subsystem sftp internal-sftp" >> /etc/ssh/sshd_config
(repeat if it was not there before)
# sshd -T
/etc/ssh/sshd_config line 131: Subsystem 'sftp' already defined.
# echo $?
255
Comment 1 kerminaawad 2021-01-06 00:16:10 AEDT
I just ran into this issue yesterday.

I prefer not to modify the main config so that future updates cannot overwrite my changes, and so that the main config is always up to date.

So I used the include feature to overwrite "Subsystem sftp", however, sshd would not start. If I had not found this bug report I would probably not have found the issue.
Comment 2 MichaIng 2022-02-27 04:22:45 AEDT
I faced the same issue, hence would also like to be able to override an existing Subsystem setting in /etc/ssh/sshd_config with one in /etc/ssh/sshd_config.d/.
Comment 3 dirdi 2022-03-13 23:16:43 AEDT
This has also been reported downstream at the Debian bug tracker: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=998834
Comment 4 CB 2022-05-06 22:41:50 AEST
I ran into this issue has well and that was kinda frustrating because it seems this is the only setting that behave like this!
Comment 5 Damien Miller 2022-05-09 09:48:07 AEST
Created attachment 3591 [details]
Make repeated Subsystem directives non-fatal