Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using System;
  2. using Renci.SshNet;
  3.  
  4. namespace SSHconsole
  5. {
  6. class MainClass
  7. {
  8.  
  9. public static void Main (string[] args)
  10. {
  11. //Connection information
  12. string user = "sshuser";
  13. string pass = "********";
  14. string host = "127.0.0.1";
  15.  
  16. //Set up the SSH connection
  17. using (var client = new SshClient (host, user, pass))
  18. {
  19.  
  20. //Start the connection
  21. client.Connect ();
  22. var output = client.RunCommand ("echo test");
  23. client.Disconnect();
  24. Console.WriteLine (output.ToString());
  25. }
  26.  
  27. }
  28. }
  29. }
  30.  
  31. Renci.SshNet.SshCommand
  32.  
  33. Press any key to continue...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement