Question

sshd fails to start on Debian 11 after reboot

I am working on a Debian 11 image. I run some ansible scripts against this host, including stopping and starting sshd. sshd fails to restart on Debian 11 only (everything works in CentOS and Debian 10). From the console, there are no journalctl files available. When I start the sshd daemon in debug mode

/usr/sbin/sshd -p 12345 -D -d -e

It runs with no errors. When I start sshd with systemctl start sshd, it says:

Job for ssh.service cancelled

And ends.

Running /usr/sbin/sshd -T spits out the sshd_config file with no errors.

ss -antp shows nothing listening.

I am running sshd on a high port.

What else can I check? Any ideas about what could be wrong?

Show comments

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
February 18, 2023

Hey @gabefish,

Try to disable SELINUX or set it to a permissive mode and see if that will still be the case.

Additionally, you can try and add the port to SELINUX with the following:

  1. semanage port -a -t ssh_port_t -p tcp XXX

Where XXX will be your port.

Additionally, see if you have your /etc/passwd file still where it should be.

alexdo
Site Moderator
Site Moderator badge
February 18, 2023

Hello @gabefish

This will usually happen when there is a config error, but if you’re running SELinux this can due to SELinux denying the port bind.

If SELinux is enabled you can add new rule for the port bind and give it another try.

Regards

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.