could not enable SSH on 22.04

Asked by April2024

After upgrading to 22.04, ssh is not accessible:

ExecStartPre=/usr/sbin/sshd -t (code=exited, status=255/EXCEPTION)
Stopped openbsd secure shell server
Ssh.service: start request repeated too qu
Ssh.service: failed with result ‘exit-code
Failed to start openbsd secure shell server

I did sudo /usr/sbin/ssd -t, which shows
no argument after keyword "DenyUsers"
no argument after keyword "DenyGroups"
terminating, 2 bad configuration options

Can someone give me a good sshd_config file?
Many thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
April2024
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

if you boot the ubuntu install cd, you can install the sevice and copy the config to the internal partitions.

In future, if you make a backup copy of config files before you mess with them, then you can easily roll back

eg:

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config-2024-03-28

Then to restore:

cat /etc/ssh/sshd_config-2024-03-28 | sudo tee /etc/ssh/sshd_config
sudo systemctl restart sshd

Revision history for this message
April2024 (april2024) said (last edit ):
#2

Can someone help me out ssh service failed issue?

Revision history for this message
April2024 (april2024) said :
#3

I checked the sshd_config file which was still the original (2018)