ssh/example/update/main.go

26 lines
400 B
Go

package main
import (
"fmt"
"blacktea.vip.cpolar.top/OrgGo/ssh"
)
func main() {
config := ssh.Default.WithPassword("ubuntu")
client, err := ssh.New(config)
// client, err := ssh.NewClient("localhost", "22", "root", "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)
}