package main
import (
"fmt"
"golang.org/x/crypto/ssh"
)
func main() {
c := &ssh.ClientConfig{
User: "root",
Auth: []ssh.AuthMethod{
ssh.Password("123456"),
},
}
_, err := ssh.Dial("tcp", "192.168.0.219:22", c) // replace this
if err != nil {
fmt.Println(err)
return
}
}
执行报错,不知道什么原因?
go version go1.7.4
Centos 6.5系统
[root@host219 ~]# go run test.go
ssh: must specify HostKeyCallback
有疑问加站长微信联系(非本文作者)