You are not logged in.

#1 2022-10-21 19:58:39

emjustem
Member
Registered: 2022-09-23
Posts: 17

[SOLVED] ssh connection refused when Host * section is present

I'm setting up sshd_config and I have this section:

Host *
        KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
        PubkeyAuthentication yes
        HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa
        PasswordAuthentication no

When this section is present, and I try to ssh in from windows

ssh: connect to host [********] port 22: Connection refused

If I comment out the line Host *, then I am able to connect with my public key (which I have already set up).

Elsewhere in my sshd_config I have

UsePAM yes
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no

and a couple other things that seem less likely to be interfering (like PrintMotd no)

I've read https://wiki.archlinux.org/title/OpenSSH but a lot of it I was not sure what applied to me. I based my config on https://stribika.github.io/2015/01/04/s … shell.html which I did pretty much understand.

Last edited by emjustem (2022-10-27 22:05:02)

Offline

#2 2022-10-21 21:14:45

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,461

Re: [SOLVED] ssh connection refused when Host * section is present

You wrote:

I'm setting up sshd_config and I have this section:

But the link you posted wrote:

Recommended /etc/ssh/ssh_config snippet:

And "Hosts *" has neither business nor sense in sshd_config. It's an invalid line and you should™ get an error for that.

Online

#3 2022-10-22 04:05:58

Quadro
Member
Registered: 2022-08-08
Posts: 8

Re: [SOLVED] ssh connection refused when Host * section is present

add '-v' for verbose and check what is going wrong while connecting

Offline

#4 2022-10-22 09:15:05

Maniaxx
Member
Registered: 2014-05-14
Posts: 761

Re: [SOLVED] ssh connection refused when Host * section is present

Delete '~/.ssh/known_hosts' and start the server manually with 'sshd -dd'.


sys2064

Offline

#5 2022-10-22 12:37:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,461

Re: [SOLVED] ssh connection refused when Host * section is present

The OP wrote:

I'm setting up sshd_config and I have this section:

If I comment out the line Host *, then I am able to connect with my public key (which I have already set up).

seth wrote:

"Hosts *" has neither business nor sense in sshd_config. It's an invalid line and you should™ get an error for that.

Online

#6 2022-10-22 18:47:23

lfitzgerald
Member
Registered: 2021-07-16
Posts: 175

Re: [SOLVED] ssh connection refused when Host * section is present

Did you mix up the sshd_config with ssh_config?

Offline

#7 2022-10-27 22:04:40

emjustem
Member
Registered: 2022-09-23
Posts: 17

Re: [SOLVED] ssh connection refused when Host * section is present

Yep I just mixed up the configs. Thanks!

Offline

Board footer

Powered by FluxBB