# Ssh\_kex2 error using ssh connection

**URL:** <https://forum.gitea.com/t/ssh-kex2-error-using-ssh-connection/4150>\
**Category:** Install/Maintain/Configure\
**Created:** [November 30, 2021, 4:33pm UTC](https://forum.gitea.com/t/ssh-kex2-error-using-ssh-connection/4150 "2021-11-30T16:33:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wusikijeronii](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/wusikijeronii/32/1619_2.png) [@wusikijeronii](https://forum.gitea.com/u/wusikijeronii)\
**Post date:** [November 30, 2021, 4:33pm UTC](https://forum.gitea.com/t/ssh-kex2-error-using-ssh-connection/4150/1 "2021-11-30T16:33:49Z")

</div>

Hello.  
I can’t connect via ssh to my gitea server.  
If I run:  
`ssh git@homedatasrv.ru -v`  
Output:

```auto
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/aleksey/.ssh/id_ed25519 ED25519 SHA256:6Ipfy5oCwGYfdsNOEinla9CYtezWZzTnpsukJOiUfTo agent
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/aleksey/.ssh/id_rsa
debug1: Trying private key: /home/aleksey/.ssh/id_dsa
debug1: Trying private key: /home/aleksey/.ssh/id_ecdsa
debug1: Trying private key: /home/aleksey/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/aleksey/.ssh/id_ed25519_sk
debug1: Trying private key: /home/aleksey/.ssh/id_xmss
debug1: No more authentication methods to try.
git@homedatasrv.ru: Permission denied (publickey).

```

If I run:  
`ssh git@homedatasrv.ru -v -o "HostKeyAlgorithms ed25519"`  
Output:

```auto
debug1: Connection established.
debug1: identity file /home/aleksey/.ssh/id_rsa type -1
debug1: identity file /home/aleksey/.ssh/id_rsa-cert type -1
debug1: identity file /home/aleksey/.ssh/id_dsa type -1
debug1: identity file /home/aleksey/.ssh/id_dsa-cert type -1
debug1: identity file /home/aleksey/.ssh/id_ecdsa type -1
debug1: identity file /home/aleksey/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/aleksey/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/aleksey/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/aleksey/.ssh/id_ed25519 type 3
debug1: identity file /home/aleksey/.ssh/id_ed25519-cert type -1
debug1: identity file /home/aleksey/.ssh/id_ed25519_sk type -1
debug1: identity file /home/aleksey/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/aleksey/.ssh/id_xmss type -1
debug1: identity file /home/aleksey/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4
debug1: compat_banner: match: OpenSSH_8.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to homedatasrv.ru:22 as 'git'
ssh_kex2: kex_assemble_namelist: invalid argument

```

What is the problem with kex2? (I don’t know what is it)  
I also tried to add the line to my sshd config:

```auto
KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1

```

---

<div class="post-metadata">

**Author:** ![wusikijeronii](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/wusikijeronii/32/1619_2.png) [@wusikijeronii](https://forum.gitea.com/u/wusikijeronii)\
**Post date:** [November 30, 2021, 6:26pm UTC](https://forum.gitea.com/t/ssh-kex2-error-using-ssh-connection/4150/2 "2021-11-30T18:26:17Z")

</div>

I’ve removed the.ssh folder from the Gitea server and recreated it. It has worked. But it didn’t have a problem with access rights 'cos I’ve checked it before removing the folder.  
About `-o "HostKeyAlgorithms ed25519` - I used the wrong key. There must be `ssh-ed25519`
