plink ssh connection with no

Tools & Utilities

plink ssh connection with no

I try in C# to make an ssh connection with plink.
I get empty output.

Process p = new Process();
p.StartInfo.FileName = @"plink.exe";
param = "-ssh -pw " + Pass + " " + User + "@" + Host + " " + Cmd;

string cd = Environment.CurrentDirectory;

if (File.Exists("plink.exe") == false)
{
throw new Exception("SSHClient: plink.exe not found.");
}

else
{
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = param;

p.Start();
p.StandardInput.Write("plink.exe " + param);

standerOut = p.StandardOutput;
string dd = p.Responding.ToString();

string f = p.StandardOutput.ReadToEnd();

while (!p.HasExited)
{
if (!standerOut.EndOfStream)
{
strReturn += standerOut.ReadLine() + Environment.NewLine;
}

}
string x = p.StandardError.ToString();

}

MessageBox.Show(strReturn);

1. dd is true
2. f is empty
3. x i get "System.IO.StreamReader"
4. strReturn i get "" (empty results)

Please please help
tx
matan
2 REPLIES

Re: plink ssh connection with no

Anf from cmd line it looks ok:

C:\>plink.exe -pw XXXXX -ssh root@XXXXXXXX ls -a

..

.history

.profile

..

..

..

C:\>

Any idea?

tx

Matan

Re: plink ssh connection with no

I managed.

tx anyway all :)