【发布时间】:2015-08-07 00:27:45
【问题描述】:
我正在尝试使用 VB.NET 和 WinSCP 运行命令 sudo bash。
我正在使用此代码:
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 呢?
【问题讨论】:
标签: .net ssh sudo winscp winscp-net