dongshao6591 2013-09-25 07:11
浏览 413
已采纳

拨号失败:握手失败:ssh:没有通用算法golang的ssh客户端错误

I'm working on a project that is using goftp to upload to a server, but (thanks to the kind people here) I will use a more secure method.

I plan to use ssh instead and found this ssh client in golang found here.

I have setup an ssh server (freeSSHd) and can successfully connect through PuTTY both locally and on another machine.

I have only changed this part of the client to replace the variables with my own

var (
    server = "127.0.0.1:22"
    username = "username"
    password = clientPassword("password")
)

When I execute the ssh client, ssh.Dial returns an error, and the panic displays this: "Failed to dial: handshake failed: ssh: no common algorithms"

client, err := ssh.Dial("tcp", "127.0.0.1:22", config)
if err != nil {
    panic("Failed to dial: " + err.Error())
}

I am new to golang so I would appreciate any help to point me in the right direction. Thanks in advance.

  • 写回答

2条回答 默认 最新

  • dongsha2792 2013-09-25 10:20
    关注

    In the source code for the go.crypto/ssh package, we can see that the supported ciphers are the following:

    • aes128-ctr
    • aes192-ctr
    • aes256-ctr
    • arcfour128
    • arcfour256

    While freeSSHd supports:

    • aes128-cbc
    • aes192-cbc
    • aes256-cbc
    • 3des-cbc
    • blowfish-cbc
    • rijndael128-cbc
    • rijndael192-cbc
    • rijndael256-cbc
    • rijndael-cbc@lysator.liu.se

    Because the client and server shares no common cipher, you will get the error message. The reason why CBC mode is not supported in the ssh package is most likely because of a vulnerability, as discussed in this golang-nuts thread.

    A solution to your problem might be to try install a different SSH server, such as OpenSSH for Windows.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算