ssh/cmd/main.go

25 lines
308 B
Go
Raw Normal View History

2018-10-30 17:45:30 +08:00
package main
import (
"fmt"
"github.com/pytool/ssh"
)
func main() {
client, err := ssh.NewClient("root", "localhost", "22", "ubuntu")
if err != nil {
panic(err)
}
defer client.Close()
output, err := client.Exec("uptime")
if err != nil {
panic(err)
}
fmt.Printf("Uptime: %s\n", output)
}