登录服务器后,如何使用C#在plink中正确键入密码

时间:2019-03-25 10:32:34

标签: c# linux putty plink

我正在使用C#和Plink自动化腻子处理过程,因此在使用“ WriteLine(” PASSWORD“);”时遇到问题并在其中输入密码,服务器响应是密码无效/或密码错误,因此,由于在Linux中输入密码时,密码不会显示(基于“ StandardOutput”),因此我不确定该密码是否确实由WriteLine函数正确输入。

我已经尝试使用“ Process”在C#中直接执行Plink,也使用CMD执行plink,但是我遇到了同样的问题。我也使用管道方法,但仍然没有成功

我尝试了此代码,但没有成功

// access to the server
strw.WriteLine("swrap user@SERVER2313");

// execute a java program to upload file in database
strw.WriteLine("JAVA PROG");

// will return where in you will type username and password of the database
Enter DB username: 
strw.WriteLine("Username"); // for username 

Enter DB password:
strw.WriteLine("PASSWORD");// for password

我也尝试过此代码

strw.WriteLine("echo JAVA PROG | username | password");

0 个答案:

没有答案
相关问题