Tag: putty

无法使用SSH.NET库连接到AIX(Unix)框 – 错误:值不能为空

我正在尝试连接到AIX盒并使用SSH.NET库执行一些命令。 以下是代码snipplet KeyboardInteractiveAuthenticationMethod kauth = new KeyboardInteractiveAuthenticationMethod(username); PasswordAuthenticationMethod pauth = new PasswordAuthenticationMethod(username, password); ConnectionInfo connectionInfo = new(ConnectionInfo(servername, 22, username, pauth,kauth); SshClient sshClient = new SshClient(connectionInfo); sshClient.Connect(); SshCommand sshCommand = sshClient.RunCommand(“mpstat”); Console.WriteLine(sshCommand.Result); Console.ReadKey(); 当我尝试在sshClient.Connect()行连接时收到以下exception消息 {“值不能为空。\ r \ nParameter name:data”} 堆栈跟踪是 at Renci.SshNet.KeyboardInteractiveAuthenticationMethod.Authenticate(Session session) at Renci.SshNet.ConnectionInfo.Authenticate(Session session) at Renci.SshNet.Session.Connect() at Renci.SshNet.BaseClient.Connect() 我确信我传递的凭据是有效的,因为我能够使用具有相同凭据的PuTTY客户端登录 。 有任何想法吗?

使用Plink.exe测试连接到C#中的SSH

我试图通过plink.exe连接到unix终端。 目标是让我可以将文本读回字符串。 我的困境是我工作的银行使用的是旧的as400类型系统,我们通常通过腻子访问。 我正在尝试开发一个自动化套件,它将与系统连接并运行作业并分析输出等。 所以我想我会通过C#使用plink。 如果我通过命令提示符运行代码,我(大致)得到我需要的文本。 但是我在C#代码中遇到了问题,因为它只是挂起而且我从来没有得到过响应。 我想要的是这样的: 连接到服务器输入命令回读屏幕//更多命令等 这是我到目前为止的代码: class Program { static void Main(string[] args) { ProcessStartInfo psi = new ProcessStartInfo(@”C:\Windows\System32\cmd”); psi.RedirectStandardInput = true; psi.RedirectStandardOutput = true; psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal; psi.UseShellExecute = false; psi.CreateNoWindow = false; Process process = Process.Start(psi); string cmdForTunnel = @”c:\putty\plink -ssh jonkers@bankhq -pw automationhero”; process.StandardInput.WriteLine(cmdForTunnel); // process.WaitForExit(); Thread.Sleep(30000); string […]