Testing using Plink.exe to connect to SSH in C#

前端 未结 2 1776
渐次进展
渐次进展 2020-12-11 12:18

Im trying to connect to a unix terminal via plink.exe. The goal is so that I can read the text back into a string.

My dilema is that the bank I work for uses an old

2条回答
  •  时光说笑
    2020-12-11 12:49

    Hey the above code worked partially for me but it was good help i juts replaced the contractor parameters as follows

    const string PLINK_PATH = @"C:\Program Files (x86)\PuTTY\plink.exe";

            Process p = new Process();
    
            // Redirect the output stream of the child process.
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;           
            p.StartInfo.FileName = PLINK_PATH;            
            p.StartInfo.Arguments = String.Format(" -ssh {0}@{1} -pw {2}", userName, remoteHost, password);
    

    Hope this helps with above code....

提交回复
热议问题