我正在编写一个使用Go程序更改root密码的程序。代码片段如下:

package main

import (
    "fmt"
    "github.com/pkg/sftp"
    "golang.org/x/crypto/ssh"
    "log"
    "os"
    "time"
)

type ServerConfig struct {
    sshHost string
    sshUser string
    sshPassword string
    sshType string
    sshPort int
}

func main() {
    server := ServerConfig{
        sshHost: "172.28.128.3",
        sshUser: "vagrant",
        sshPassword: "*****",
        sshPort: 22,
        sshType: "password",
    }
    sshClient := SSHConnet(server)
    defer sshClient.Close()
    session,err := sshClient.NewSession()
    if err != nil {
        log.Fatal("creat ssh session fail",err)
    }
    defer session.Close()
    session.Stdout = os.Stdout
    session.Stderr = os.Stdout
    session.Stdin = os.Stdin
    err = session.Run("su -; whoami")
    if err != nil {
        log.Println(err)
    }

即使输入了正确的root密码,仍然会提示我验证失败。有人能帮我吗?非常感谢

go run main.go
Password: ******
su: Authentication failure
vagrant