ssh报错 ssh: must specify HostKeyCallback

eagle · · 7944 次点击
非常感谢您!
#2
更多评论
``` client, err := ssh.Dial("tcp", "192.168.1.71:22", &ssh.ClientConfig{ User: "kevin", Auth: []ssh.AuthMethod{ ssh.Password("ajiao0106"), }, //需要验证服务端,不做验证返回nil就可以,点击HostKeyCallback看源码就知道了 HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error { return nil }, }) fmt.Println(err) fmt.Println(client) ```
#1