我尝试了以下代码,使用ssh从c#在Linux的Download文件夹下创建测试目录。
SshClient sshclient;
using (sshclient = new SshClient("192.168.0.15", 22, "oracle", "oracle"))
{
sshclient.KeepAliveInterval = new TimeSpan(0, 1, 40);
sshclient.ConnectionInfo.Timeout = new TimeSpan(0,1, 20);
sshclient.Connect();
SshCommand x;
x = sshclient.RunCommand("mkdir -p /home/oracle/Downloads/test");
x.Execute();
string answer = x.Result;
}
上面的代码没有给出任何异常,但是我已经使用调试器附加了堆栈跟踪