我正在尝试sudo bash
使用 VB.NET 和 WinSCP 运行命令。
我正在使用这段代码:
Try
Dim mySessionOptions As New SessionOptions
With mySessionOptions
.Protocol = Protocol.Sftp
.HostName = "10.5...."
.UserName = "hereGoesUsername"
.Password = "hereGoesPassword"
.SshHostKeyFingerprint = "ssh-rsa 2048 ......"
End With
mySession.Open(mySessionOptions)
Try
mySession.ExecuteCommand("sudo bash").Check()
最后一行给了我一个错误
sudo:不存在 tty,也没有指定 askpass 程序。
我无法输入密码。如果我在 Windows 上使用命令行ssh username@host
,那么它会要求输入密码,我输入然后我可以运行sudo bash
并再次输入密码,但是如何使用 WinSCP 呢?