使用远程工具secureCRT (版本:Version 7.0.0 (x64 build 326) ) 连接Linux(Ubuntu-22.04)系统 |
若20之前的ubuntu系统版本参考:: 🔗使用远程工具连接Linux系统 |
1、检查ssh-server版本
sudo dpkg -l | grep ssh
打印返回
ii libssh-4:amd64 0.9.6-2ubuntu0.22.04.3 amd64 tiny C SSH library (OpenSSL flavor)
ii libssh-gcrypt-4:amd64 0.9.6-2ubuntu0.22.04.3 amd64 tiny C SSH library (gcrypt flavor)
ii openssh-client 1:8.9p1-3ubuntu0.6 amd64 secure shell (SSH) client, for secure access to remote machines
ii openssh-server 1:8.9p1-3ubuntu0.6 amd64 secure shell (SSH) server, for secure access from remote machines
ii openssh-sftp-server 1:8.9p1-3ubuntu0.6 amd64 secure shell (SSH) sftp server module, for SFTP access from remote machines
ii python3-paramiko 2.9.3-0ubuntu1.2 all Make ssh v2 connections (Python 3)
ii ssh-import-id 5.11-0ubuntu1 all securely retrieve an SSH public key and install it locally
Tip:若查询结果没有openssh-server,执行apt install -y openssh-server |
2、连接报错
Key exchange failed. No compatible key exchange method. The server supports these methods: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,sntrup761x25519-sha512@openssh.com,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,kex-strict-s-v00@openssh.com No compatible hostkey. The server supports these methods: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 |
报错说: 密钥交换失败。没有兼容的密钥交换方法。列举以下的方法 那就来添加交换密钥的方法 |
解决方法
vim /etc/ssh/sshd_config
在尾行输入以下内容
HostKeyAlgorithms=+ssh-rsa,ssh-dss
KexAlgorithms=+diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
然后Esc键,输入:wq保存退出,输入以下命令,重启ssh服务
systemctl restart sshd.service
或
service ssh restart
⛏✔