1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| public static void Main(string[] args)
{
//Connection information
String IP = "";
//int Port = ;
String SCM = "";
String Scmpass = "";
//Set up the SSH connection
using (var client = new SshClient(IP, ****, SCM, ****))
{
//Start the connection
client.Connect();
32------------->>>>>>>> Console.Write("SSH ist verbunden ");//ssh is connected
Console.WriteLine();
//client.RunCommand("su -");
SshCommand sc = client.CreateCommand(string.Format("su -"));
sc.Execute();
Console.Write(sc.Result );
Console.Write("su command ist abgegeben ");
Console.WriteLine();
client.KeepAliveInterval = new TimeSpan(0, 0, 5);
Console.Write("Root Passwort: ");
String Rootpass = Console.ReadLine();
SshCommand rootpass = client.CreateCommand(Rootpass);
rootpass.Execute();
client.KeepAliveInterval = new TimeSpan(0, 0, 3); |
Partager