Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Connect to linux server by SSH.NET library

$
0
0
Hi,

I'm new user of SSH.NET, I have some questions on it.
  1. How can I su my account by runcommand or runshell? I know it's an old question, but I didn't find a worked solution for me on the internet. Could you help?
  2. I'd like to execute a script on linux server, I have a sample code as below.
var ssh = new SshClient("ip", "user", "password");
var cmd = ssh .CreateCommand("./executescript");
cmd.BeginExecute();
var reader = new StreamReader(cmd.OutputStream);
var result = reader.ReadToEnd();

but I can't finish executing the script because it will ask a question like 'would you like to do that? yes or no', how can I send yes or no during executing the scripts?

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>