I found this error "Unable to negotiate with IPADDRESS port XXXX: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1" when I use ssh command to remote Linux Server on Ubuntu client version 20.04 up. This error can fix by creating a new file config at the path .ssh see below.
cd /home/userlogin/.ssh
vim config
Add text following
---------------------------------------------------------
Host mail.yourserver.com diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
-----------------------------------------------------------
save file and run command ssh again it is successful with ubuntu 20.04 but if you use ubuntu 22.04 you'll find more errors like this "Unable to negotiate with IPADDRESS port XXXX: no matching host key type found. Their offer: ssh-rsa,ssh-dss" you can fix it by adding more text at file config like this.
---------------------------------------------------------
Host mail.yourserver.com diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
HostKeyAlgorithms ssh-rsa
PubkeyAcceptedKeyTypes ssh-rsa
-----------------------------------------------------------
now you can use ssh command on ubuntu and you can create a shortcut command in file .bashrc like this
add text following to the button
---------------------------------------------------------
# alias
alias myserver='ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -p xxxx admin@mail.yourserver.com'
---------------------------------------------------------
and then run . ~/.bashrc for creating shortcut command
Referrence:
For HostKeyAlgorithms ssh-rsa
No comments:
Post a Comment