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


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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.