GoLang ssh:尽管将其设置为nil,但仍然出现“必须指定HosKeyCallback”错误

I am trying to connect to a remote server using GoLang. In the client configuration, apart from user and password, I set HostKeyCallback to nil so that it accepts every host

config := &ssh.ClientConfig{

        User: user,

        HostKeyCallback: nil,

        Auth: []ssh.AuthMethod{

        publicKey,
    },
}

But I keep getting this error.

Failed to dial: ssh: must specify HostKeyCallback

How do I solve this ?

查看全部
duan6161
duan6161
2017/05/30 18:12
  • ssh
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复