sshd will fail to start or restart if non-default Port option is incorrectly put after a non-default ListenAddress
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openssh (Ubuntu) |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
I have a system where the default listening port is changed for sshd, done at the bottom of my sshd_config. I recently changed the ListenAddress from its default (unset, which listens on all interfaces) to bind to a specific IP. The resulting relevant snippet of my sshd_config was:
ListenAddress my_ip_here
Port 12345
I then restarted ssh with /etc/init.d/ssh restart and found that ssh was not listening.
Re-reading the manpage, I see this:
ListenAddress
lowing forms may be used:
If port is not specified, sshd will listen on the address and all
prior Port options specified. The default is to listen on all
local addresses. Multiple ListenAddress options are permitted.
port qualified addresses.
On a hunch, I remove the Port line and simply change my relevant config to:
ListenAddress my_ip_here:12345
sshd then restarted just fine.
In looking at the logs, I see:
Dec 1 11:40:26 jhart-laptop kernel: [1207947.954263] init: ssh main process (26655) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.954277] init: ssh main process ended, respawning
Dec 1 11:40:26 jhart-laptop kernel: [1207947.957687] init: ssh main process (26658) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.957703] init: ssh main process ended, respawning
Dec 1 11:40:26 jhart-laptop kernel: [1207947.961094] init: ssh main process (26661) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.961115] init: ssh main process ended, respawning
Dec 1 11:40:26 jhart-laptop kernel: [1207947.964835] init: ssh main process (26664) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.964852] init: ssh main process ended, respawning
Dec 1 11:40:26 jhart-laptop kernel: [1207947.968028] init: ssh main process (26667) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.968043] init: ssh main process ended, respawning
Dec 1 11:40:26 jhart-laptop kernel: [1207947.971004] init: ssh main process (26670) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.971021] init: ssh main process ended, respawning
Dec 1 11:40:26 jhart-laptop kernel: [1207947.974044] init: ssh main process (26673) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.974087] init: ssh main process ended, respawning
Dec 1 11:40:26 jhart-laptop kernel: [1207947.977853] init: ssh main process (26676) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.977868] init: ssh main process ended, respawning
Dec 1 11:40:26 jhart-laptop kernel: [1207947.980928] init: ssh main process (26679) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.980944] init: ssh main process ended, respawning
Dec 1 11:40:26 jhart-laptop kernel: [1207947.984059] init: ssh main process (26682) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.984075] init: ssh main process ended, respawning
Dec 1 11:40:26 jhart-laptop kernel: [1207947.987118] init: ssh main process (26685) terminated with status 255
Dec 1 11:40:26 jhart-laptop kernel: [1207947.987132] init: ssh respawning too fast, stopped
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: openssh-server 1:5.9p1-5ubuntu1.7
ProcVersionSign
Uname: Linux 3.13.0-66-generic x86_64
ApportVersion: 2.0.1-0ubuntu17.13
Architecture: amd64
Date: Tue Dec 1 11:54:42 2015
InstallationMedia: Ubuntu 12.04.5 LTS "Precise Pangolin" - Release amd64 (20140807)
MarkForUpload: True
ProcEnviron:
TERM=xterm
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/zsh
SourcePackage: openssh
UpgradeStatus: No upgrade log present (probably fresh install)
Thank you for taking the time to report this bug and helping to make Ubuntu better.
Please attach an example sshd_config that fails as you describe, and then change the bug status back to New. Thanks!