How-To-Secure-A-Linux-Server icon indicating copy to clipboard operation
How-To-Secure-A-Linux-Server copied to clipboard

SSH listenaddress bug note

Open JustEnoughDucks opened this issue 4 years ago • 3 comments

In some systems this bug will occur: sshd will not start at boot if ListenAddress is set. I ran into it myself following this guide. It is a failure of systemd and ssh devs to communicate who will fix it.

Anyway, there is a simple workaround to it by 'nimishp12':

changing /etc/systemd/system/sshd.service:

After=network.target audit.target
Wants=network.target

to

Requires=multi-user.target
Before=shutdown.target
After=multi-user.target
Wants=multi-user.target

This also solves the problem of using various network.service/targets that may still cause issues just using Before/After network-online.target

JustEnoughDucks avatar Nov 28 '20 15:11 JustEnoughDucks

Does this work for you? It doesn't work for me.

imthenachoman avatar Dec 14 '20 20:12 imthenachoman

Did you end up having the listenaddress issue too?

Yes, the lines I posted work for me, but in that bug report, I think there are 3 different methods to try (like the network-online.target Before/after). I am really not sure why different ones are working for different people. Perhaps it is just the service start order?

JustEnoughDucks avatar Dec 15 '20 15:12 JustEnoughDucks

Yes, I had issues. I will keep playing with it.

imthenachoman avatar Dec 15 '20 16:12 imthenachoman