亚欧色一区w666天堂,色情一区二区三区免费看,少妇特黄A片一区二区三区,亚洲人成网站999久久久综合,国产av熟女一区二区三区

  • 發布文章
  • 消息中心
點贊
收藏
評論
分享
原創

ssh版本原因導致無法連接問題解決

2024-12-02 09:40:11
143
0

異常表現

com.jcraft.jsch.JSchException: Algorithm negotiation fail
	at com.jcraft.jsch.Session.receive_kexinit(Session.java:595)
	at com.jcraft.jsch.Session.connect(Session.java:325)

出現這個(ge)問題主(zhu)要是客戶端與服(fu)務器的算法不(bu)一(yi)致導(dao)致的,主(zhu)要是ssh版本不(bu)一(yi)致

解決方案一

使用命令查看(kan)服務器支持的算法

ssh -vvv 目標機器ip

再返回的(de)結果中找到服務端的(de)HostKeyAlgorithms和KexAlgorithms配置(zhi),如

HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss

KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

 

手動登陸(lu)實例主機,編輯(ji)ssh配(pei)置(zhi)文件,注釋掉原有的HostKeyAlgorithms和KexAlgorithms配(pei)置(zhi),把(ba)上(shang)一步(bu)找的配(pei)置(zhi)粘貼進去

vi /etc/ssh/sshd_config

重啟sshd

systemctl restart sshd

檢查(cha)ssh運行狀態是(shi)否成功重啟,狀態為running為正常

可以(yi)通(tong)過以(yi)下(xia)命(ming)令檢查配置是否(fou)生效(xiao)
ssh -o ProxyCommand="ncat --proxy {代理ip}:{代理port} --proxy-type socks5 --proxy-auth {代理賬號}:{代理密碼} %h %p" {目標主機ip} -vvv
0條評論
0 / 1000
彭程
4文章數
0粉絲數
彭程
4 文章 | 0 粉絲
彭程
4文章數
0粉絲數
彭程
4 文章(zhang) | 0 粉絲
原創

ssh版本原因導致無法連接問題解決

2024-12-02 09:40:11
143
0

異常表現

com.jcraft.jsch.JSchException: Algorithm negotiation fail
	at com.jcraft.jsch.Session.receive_kexinit(Session.java:595)
	at com.jcraft.jsch.Session.connect(Session.java:325)

出現這個問題主(zhu)要(yao)是客戶端與服務器的算法不一(yi)致(zhi)導(dao)致(zhi)的,主(zhu)要(yao)是ssh版本(ben)不一(yi)致(zhi)

解決方案一

使用命令查看服(fu)務器(qi)支持的(de)算法

ssh -vvv 目標機器ip

再返(fan)回的(de)結果中找到服務(wu)端(duan)的(de)HostKeyAlgorithms和KexAlgorithms配(pei)置(zhi),如

HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss

KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

 

手動(dong)登陸實例主機,編輯ssh配置文件,注釋(shi)掉原有的HostKeyAlgorithms和KexAlgorithms配置,把上(shang)一步找的配置粘貼進去

vi /etc/ssh/sshd_config

重(zhong)啟(qi)sshd

systemctl restart sshd

檢查ssh運(yun)行狀態是否成功重啟,狀態為running為正常

可以通過以下命令檢查配置是否生效(xiao)
ssh -o ProxyCommand="ncat --proxy {代理ip}:{代理port} --proxy-type socks5 --proxy-auth {代理賬號}:{代理密碼} %h %p" {目標主機ip} -vvv
文章來自個人專欄
文章 | 訂閱
0條評論
0 / 1000
請輸入你的評論
0
0